Storage space expansion method, device, equipment and computer readable storage medium
By receiving terminal instructions to determine the storage space expansion size of the database data block and automatically expand it, it solves the problem of difficulty in estimating the storage space expansion size in database online transaction processing, improves performance and reduces costs.
Patent Information
- Application Number
- CN202111537072.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-13
- Publication Date
- 2024-10-29
- Estimated Expiration
- 2041-12-13
AI Technical Summary
During the online transaction processing of the database, the expansion size of the data block storage space cannot be effectively estimated, resulting in IO performance problems.
By receiving instructions sent by the terminal, it is determined whether the free storage space of the target data block is greater than the threshold, and the storage space is expanded according to the size of the storage space that needs to be expanded, and the storage space is expanded in an automated manner.
It solves the problem of difficulty in estimating storage space expansion size, realizes automatic storage space expansion, saves human resources, reduces maintenance costs, and improves server performance.
Smart Images

Figure CN114253476B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of computer technology, and in particular to a storage space expansion method, device, equipment, and computer-readable storage medium. Background Art
[0002] With the continuous development of computer technology, database applications are becoming more and more extensive, so the importance of database performance is becoming more and more prominent. Central Processing Unit (CPU), Input and Output (IO), memory and other hardware are important foundations of database performance. Because IO is at the bottom of the computer's multi-layer buffer architecture, IO has become an important factor affecting database performance issues.
[0003] Typically, in an online transaction processing (OLTP) scenario of a database, operations such as adding, deleting, and modifying require expansion of data block storage space through random write IO.
[0004] However, the appropriate size of the data block storage space will be affected by the specific operations performed on the data block and cannot be accurately estimated. Summary of the invention
[0005] In order to solve the above technical problems, the present disclosure provides a storage space expansion method, device, equipment and computer-readable storage medium to determine how much storage space to expand according to instructions.
[0006] In a first aspect, an embodiment of the present disclosure provides a storage space expansion method, including:
[0007] receiving an instruction sent by a terminal, the instruction being processed by a first process, the instruction including identification information of a target data block and an operation performed on the target data block;
[0008] Determine whether the free storage space of the target data block is greater than a threshold value according to the instruction;
[0009] If the free storage space of the target data block is less than the threshold, determining the size of the storage space required to be expanded for the target data block;
[0010] The storage space of the target data block is expanded according to the size of the storage space required to be expanded for the target data block.
[0011] In a second aspect, an embodiment of the present disclosure provides a storage space expansion device, including:
[0012] A receiving module, configured to receive an instruction sent by a terminal, wherein the instruction is processed by a first process and includes identification information of a target data block and an operation performed on the target data block;
[0013] A first determination module, configured to determine whether the free storage space of the target data block is greater than a threshold value according to the instruction;
[0014] A second determination module, configured to determine the size of the storage space required to be expanded for the target data block when the free storage space of the target data block is less than a threshold;
[0015] The expansion module is used to expand the storage space of the target data block according to the size of the storage space required to be expanded by the target data block.
[0016] In a third aspect, an embodiment of the present disclosure provides a server, including:
[0017] Memory;
[0018] Processor; and
[0019] Computer programs;
[0020] The computer program is stored in the memory and is configured to be executed by the processor to implement the method as described in the first aspect.
[0021] In a fourth aspect, an embodiment of the present disclosure provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program is executed by a processor to implement the method described in the first aspect.
[0022] In a fifth aspect, an embodiment of the present disclosure further provides a computer program product, which includes a computer program or instructions, and when the computer program or instructions are executed by a processor, the storage space expansion method as described above is implemented.
[0023] The storage space expansion method, device, equipment and computer-readable storage medium provided by the embodiments of the present disclosure receive instructions sent by a terminal, the instructions are processed by a first process, the instructions include identification information of a target data block, operations performed on the target data block, and then determine whether the free storage space of the target data block is greater than a threshold value according to the instructions. If the free storage space of the target data block is less than the threshold value, the size of the storage space required to be expanded for the target data block is determined. Further, the storage space of the target data block is expanded according to the size of the storage space required to be expanded for the target data block. Since it is determined whether the storage space needs to be expanded according to the instructions, if the storage space needs to be expanded, the size of the storage space required to be expanded for the target data block is further determined. Different instructions are executed, and the size of the storage space expanded is different. This is more flexible, and the size of the storage space required to be expanded can be determined, which solves the problem that the prior art cannot well estimate how much storage space to expand. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the principles of the present disclosure.
[0025] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0026] Figure 1 A flow chart of a storage space expansion method provided in an embodiment of the present disclosure;
[0027] Figure 2 A schematic diagram of an application scenario provided by an embodiment of the present disclosure;
[0028] Figure 3 A schematic diagram of a locking process provided in an embodiment of the present disclosure;
[0029] Figure 4 A flow chart of a storage space expansion method provided by another embodiment of the present disclosure;
[0030] Figure 5 A flow chart of a storage space expansion method provided by another embodiment of the present disclosure;
[0031] Figure 6 A schematic diagram of the structure of a storage space expansion device provided in an embodiment of the present disclosure;
[0032] Figure 7 A schematic diagram of the structure of a server provided in an embodiment of the present disclosure. DETAILED DESCRIPTION
[0033] In order to more clearly understand the above-mentioned objectives, features and advantages of the present disclosure, the scheme of the present disclosure will be further described below. It should be noted that the embodiments of the present disclosure and the features in the embodiments can be combined with each other without conflict.
[0034] In the following description, many specific details are set forth to facilitate a full understanding of the present disclosure, but the present disclosure may also be implemented in other ways different from those described herein; it is obvious that the embodiments in the specification are only part of the embodiments of the present disclosure, rather than all of the embodiments. The specific embodiments described herein are only used to explain the present invention, rather than to limit the present invention. Based on the described embodiments of the present invention, all other embodiments obtained by ordinary technicians in the field are within the scope of protection of the present invention.
[0035] With the continuous development of computer technology, database applications are becoming more and more extensive, so the importance of database performance is becoming more and more prominent. Central Processing Unit (CPU), Input and Output (IO), memory and other hardware are important foundations of database performance. Because IO is at the bottom of the computer's multi-layer buffer architecture, IO has become an important factor affecting database performance issues.
[0036] Typically, in an online transaction processing (OLTP) scenario of a database, operations such as adding, deleting, and modifying require expansion of data block storage space through random write IO.
[0037] However, the appropriate size of the data block storage space is affected by the specific operations performed on the data block and cannot be well estimated. To address this problem, the present disclosure provides a storage space expansion method, which is described below in conjunction with a specific embodiment.
[0038] Figure 1 A flow chart of a storage space expansion method provided in an embodiment of the present disclosure. The method can be applied to Figure 2 The application scenario shown includes a server 21 and a terminal 22, and the terminal 22 can be a terminal, for example, a smart phone, a handheld computer, a tablet computer, a wearable device with a display screen, a desktop computer, a laptop computer, an all-in-one machine, a smart home device, etc. It can be understood that the storage space expansion method provided in the embodiment of the present disclosure can also be applied in other scenarios.
[0039] Combine the following Figure 2 The application scenario shown is Figure 1The storage space expansion method shown in the figure is introduced, and the specific steps of the method are as follows:
[0040] S101. Receive an instruction sent by a terminal, where the instruction is processed by a first process and includes identification information of a target data block and an operation performed on the target data block.
[0041] like Figure 2 The terminal 22 sends an instruction to the server 21, such as inserting a tuple or several tuples into the target data block. The server 21 receives the instruction sent by the terminal 22, which includes the identification information of the target data block and the operation performed on the target data block. The instruction is processed by the first process.
[0042] S102: Determine whether the free storage space of the target data block is greater than a threshold according to the instruction.
[0043] After receiving the instruction from the terminal 22, when the instruction includes an operation of insert or update, the server 21 determines whether the free storage space of the target data block is greater than a threshold value to ensure that the target data block has storage space to perform the operation.
[0044] S103: If the free storage space of the target data block is less than a threshold, determine the size of the storage space required to be expanded for the target data block.
[0045] If the server 21 determines that the free storage space of the target data block is less than the threshold, the server 21 determines the size of the storage space required to be expanded for the target data block.
[0046] S104: Expand the storage space of the target data block according to the size of the storage space that needs to be expanded for the target data block.
[0047] After determining the size of the storage space required to be expanded for the target data block, the server 21 expands the storage space of the target data block according to the size of the storage space required to be expanded for the target data block.
[0048] The disclosed embodiment receives instructions sent by a terminal, which are processed by a first process. The instructions include identification information of a target data block and an operation performed on the target data block. Then, according to the instructions, it is determined whether the free storage space of the target data block is greater than a threshold value. If the free storage space of the target data block is less than the threshold value, the size of the storage space required to be expanded for the target data block is determined. Further, according to the size of the storage space required to be expanded for the target data block, the storage space of the target data block is expanded. Since it is determined whether the storage space needs to be expanded according to the instructions, if the storage space needs to be expanded, the size of the storage space required to be expanded for the target data block is further determined. Different instructions are executed, and the size of the expanded storage space is different. This is more flexible, and the size of the storage space required to be expanded can be determined, which solves the problem that the prior art cannot well estimate how much storage space to expand.
[0049] In addition, the embodiments of the present disclosure do not require manual operation. Compared with the prior art which requires manual pre-expansion of storage space through a time window, the embodiments of the present disclosure can automatically expand the storage space, saving human resources, making it easier to expand the storage space, and reducing maintenance costs.
[0050] Figure 4 A flow chart of a storage space expansion method provided by another embodiment of the present disclosure is as follows: Figure 4 As shown, the method includes the following steps:
[0051] S401. Receive an instruction sent by a terminal, where the instruction is processed by a first process and includes identification information of a target data block and an operation performed on the target data block.
[0052] Specifically, the implementation process and principle of S401 and S101 are the same, and will not be repeated here.
[0053] S402: Determine the threshold according to the instruction.
[0054] After the server 21 receives the instruction sent by the terminal 22, the instruction includes the identification information of the target data block and the operation performed on the target data block, and the threshold is determined according to the specific operation performed. For example, if a tuple is inserted into the target data block, the threshold is the size of a tuple. If two tuples are inserted, the threshold is the size of two tuples.
[0055] S403: Based on the threshold and the free storage space of the target data block, determine whether the free storage space of the target data block is greater than the threshold; if so, execute S409; otherwise, execute S404.
[0056] The server 21 obtains the size of the free storage space of the target data block, and then determines whether the free storage space of the target data block is greater than the threshold value based on the threshold value and the size of the free storage space of the target data block. If the free storage space of the target data block is greater than the threshold value, step S409 is executed; if the free storage space of the target data block is less than the threshold value, the following step S406 and steps after S406 are executed.
[0057] S404: Lock the target data block accessed by the instruction, so that after the locking is successful, a second process behind the first process in the waiting queue cannot perform operations on the target data block.
[0058] like Figure 3 As shown, if the available storage space of the target data block is less than a threshold, the first process of the server 21 locks the target data block accessed by the instruction, so that after the locking is successful, the second process behind the first process in the waiting queue cannot perform operations on the target data block.
[0059] For example, when the first process locks the target data block, a waiting number of 1 will be added to the shared memory. If other processes want to access the target data block later, each process will add 1 to the waiting number, and the waiting background process will maintain a waiting queue to identify the order. When the first process releases the lock, the waiting number is reduced by 1, and the second process can lock the target data block in order.
[0060] S405, detecting whether a third process has expanded the target data block, if so, executing S409, otherwise, executing S406.
[0061] After locking the target data block accessed by the instruction, the server 21 detects whether a third process has expanded the target data block. If so, step S409 is executed; if not, the following step S406 and steps after S406 are executed.
[0062] S406: Determine the size of the storage space required to expand the target data block.
[0063] If no third process is used to expand the target data block, the server 21 determines the size of the storage space required to expand the target data block.
[0064] S407: Expand the storage space of the target data block according to the size of the storage space required to be expanded for the target data block.
[0065] Specifically, the implementation process and principle of S407 and S104 are the same, and will not be repeated here.
[0066] S408: Release the lock on the target data block accessed by the instruction.
[0067] After the storage space of the target data block is expanded, the server 21 releases the lock on the target data block accessed by the instruction.
[0068] S409: Expansion ends.
[0069] When the free storage space of the target data block is greater than the threshold, or a third process has expanded the target data block, or the expansion of the storage space of the target data block is completed, the server 21 releases the lock on the target data block accessed by the instruction, and the expansion of the storage space ends.
[0070] The disclosed embodiment receives an instruction sent by a terminal, the instruction is processed by a first process, the instruction includes identification information of a target data block, an operation performed on the target data block, and the threshold is determined according to the instruction. Then, based on the threshold and the free storage space of the target data block, it is determined whether the free storage space of the target data block is greater than the threshold. If the free storage space of the target data block is less than the threshold, the target data block accessed by the instruction is locked. Further, it is detected whether a third process has expanded the target data block. If no third process has expanded the target data block, the size of the storage space required to expand the target data block is determined. According to the size of the storage space required to expand the target data block, the storage space of the target data block is expanded, and the target data block accessed by the instruction is unlocked. Since the target data block accessed by the instruction is locked, after the locking is successful, the second process after the first process in the waiting queue cannot perform an operation on the target data block, and the random write IO operated by multiple processes concurrently when the storage space is expanded in the prior art is changed into a sequential write IO operated by a single process. Since the impact of sequential write IO on the performance of a storage device is smaller than that of random write IO on the performance of a storage device, the embodiments of the present disclosure can significantly improve the performance of a server when expanding storage space.
[0071] Figure 5 A flow chart of a storage space expansion method provided by another embodiment of the present disclosure is as follows: Figure 5 As shown, the method includes the following steps:
[0072] S501: Receive an instruction sent by a terminal, where the instruction is processed by a first process and includes identification information of a target data block and an operation performed on the target data block.
[0073] Specifically, the implementation process and principle of S501 and S101 are the same, and will not be described in detail here.
[0074] S502: Determine whether the free storage space of the target data block is greater than a threshold according to the instruction.
[0075] Specifically, the implementation process and principle of S502 and S102 are the same, and will not be repeated here.
[0076] S503: If the free storage space of the target data block is less than a threshold, the storage space size required to expand the target data block is predicted by the number of waiting processes in the waiting queue, and the number of waiting processes in the waiting queue is read from the shared memory.
[0077] If the server 21 determines that the free storage space of the target data block is less than the threshold, the storage space size required to expand the target data block is predicted by the process waiting number in the waiting queue, and the process waiting number in the waiting queue is read from the shared memory.
[0078] like Figure 3 As shown, there are 5 processes in the waiting queue, and the number of process waiting is 5. The size of the storage space required to expand the target data block is predicted by "number of process waiting * preset base * size of a data block". Normally, a data block is about 8KB, the preset base is 10, and the current prediction is that the size of the storage space required to expand the target data block is 400KB.
[0079] S504. Compare the predicted storage space size required for expansion of the target data block and the upper limit value of the expansion storage space, and use the smaller value of the predicted storage space size required for expansion of the target data block and the upper limit value of the expansion storage space as the storage space size required for expansion of the target data block.
[0080] like Figure 2 The server 21 shown compares the predicted storage space size required for expansion of the target data block and the upper limit value of the expanded storage space, and takes the smaller value of the predicted storage space size required for expansion of the target data block and the upper limit value of the expanded storage space as the storage space size required for expansion of the target data block.
[0081] Optionally, the upper limit of the extended storage space may be 8 MB. If the storage space is expanded too much, it will also cause temporary IO jitter to the IO system. We choose 8 MB as an upper limit.
[0082] S505: Expand the storage space of the target data block according to the size of the storage space required to be expanded for the target data block.
[0083] Specifically, the implementation process and principle of S505 and S104 are the same, and will not be repeated here.
[0084] The disclosed embodiment receives an instruction sent by a terminal, the instruction is processed by a first process, the instruction includes identification information of a target data block, an operation performed on the target data block, and determines whether the free storage space of the target data block is greater than a threshold value according to the instruction. If the free storage space of the target data block is less than the threshold value, the size of the storage space required to be expanded for the target data block is predicted by the number of process waits in the waiting queue, and the number of process waits in the waiting queue is read from the shared memory. Then, the predicted size of the storage space required to be expanded for the target data block is compared with the upper limit value of the expanded storage space, and the smaller value of the predicted size of the storage space required to be expanded for the target data block and the upper limit value of the expanded storage space is used as the size of the storage space required to be expanded for the target data block. Further, according to the size of the storage space required to be expanded for the target data block, the storage space of the target data block is expanded. Since the upper limit value of the expanded storage space is set, the server compares the predicted size of the expanded storage space required for the target data block and the upper limit value of the expanded storage space, and uses the smaller value of the predicted size of the expanded storage space required for the target data block and the upper limit value of the expanded storage space as the size of the expanded storage space required for the target data block. This can prevent the IO system from experiencing temporary IO jitter due to excessive expansion of the storage space, and further improves the performance of the server when expanding the storage space.
[0085] Figure 6 The schematic diagram of the structure of the storage space expansion device provided in the embodiment of the present disclosure. The storage space expansion device may be the server as described in the above embodiment, or the storage space expansion device may be a component or assembly in the server. The storage space expansion device provided in the embodiment of the present disclosure may execute the processing flow provided in the storage space expansion method embodiment, such as Figure 6 As shown, the storage space expansion device 60 includes: a receiving module 61, a first determining module 62, a second determining module 63, and an expansion module 64; wherein the receiving module 61 is used to receive instructions sent by the terminal, the instructions are processed by the first process, and the instructions include identification information of the target data block and the operation performed on the target data block; the first determining module 62 is used to determine whether the free storage space of the target data block is greater than a threshold value according to the instructions; the second determining module 63 is used to determine the size of the storage space required to be expanded for the target data block when the free storage space of the target data block is less than the threshold value; the expansion module 64 is used to expand the storage space of the target data block according to the size of the storage space required to be expanded for the target data block.
[0086] Optionally, when determining whether the available storage space of the target data block is greater than a threshold value according to the instruction, the first determination module 62 is specifically used to: determine the threshold value according to the instruction; and determine whether the available storage space of the target data block is greater than the threshold value based on the threshold value and the available storage space of the target data block.
[0087] Optionally, the second determination module 63 includes a processing unit 631, a detection unit 632 and a determination unit 633; wherein the processing unit 631 is used to lock the target data block accessed by the instruction when the free storage space of the target data block is less than a threshold value, so that after the locking is successful, the second process behind the first process in the waiting queue cannot perform operations on the target data block; the detection unit 632 is used to detect whether a third process has expanded the target data block; the determination unit 633 is used to determine the size of the storage space required to expand the target data block when no third process has expanded the target data block.
[0088] Optionally, the processing unit 631 is further configured to release the lock on the target data block accessed by the instruction after the expansion module expands the storage space of the target data block according to the storage space size required to be expanded by the target data block.
[0089] Optionally, when determining the size of the storage space required to be expanded for the target data block, the second determination module 63 is specifically used to: predict the size of the storage space required to be expanded for the target data block by using the number of process waiting in the waiting queue, wherein the number of process waiting in the waiting queue is read from the shared memory; compare the predicted size of the storage space required to be expanded for the target data block with the upper limit value of the expanded storage space, and use the smaller value between the predicted size of the storage space required to be expanded for the target data block and the upper limit value of the expanded storage space as the size of the storage space required to be expanded for the target data block.
[0090] Figure 6 The storage space expansion device of the illustrated embodiment can be used to execute the technical solution of the above-mentioned method embodiment. Its implementation principle and technical effect are similar and will not be repeated here.
[0091] Figure 7 The server provided in the embodiment of the present disclosure may be a server as described in the above embodiment. The server provided in the embodiment of the present disclosure may execute the processing flow provided in the storage space expansion method embodiment, such as Figure 7 As shown, the server 70 includes: a memory 71, a processor 72, a computer program and a communication interface 73; wherein the computer program is stored in the memory 71 and is configured so that the processor 72 executes the storage space expansion method as described above.
[0092] In addition, an embodiment of the present disclosure further provides a computer-readable storage medium on which a computer program is stored. The computer program is executed by a processor to implement the storage space expansion method described in the above embodiment.
[0093] In addition, an embodiment of the present disclosure also provides a computer program product, which includes a computer program or instructions, and when the computer program or instructions are executed by a processor, the storage space expansion method as described above is implemented.
[0094] It should be noted that the computer-readable medium disclosed above may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, 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 above. In the present disclosure, a computer-readable storage medium may be any tangible medium containing or storing a program that may be used by or in combination with an instruction execution system, device or device. In the present disclosure, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, in which a computer-readable program code is carried. This propagated data signal may take a variety of forms, including but not limited to an electromagnetic signal, an optical signal, or any suitable combination of the above. The computer readable signal medium 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. The program code contained on the computer readable medium may be transmitted using any suitable medium, including but not limited to: wires, optical cables, RF (radio frequency), etc., or any suitable combination of the above.
[0095] In some embodiments, the client and the server may communicate using any currently known or future developed network protocol such as HTTP (HyperText 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.
[0096] The computer-readable medium may be included in the server, or may exist independently without being installed in the server.
[0097] The computer-readable medium carries one or more programs. When the one or more programs are executed by the server, the server:
[0098] receiving an instruction sent by a terminal, the instruction being processed by a first process, the instruction including identification information of a target data block and an operation performed on the target data block;
[0099] Determine whether the free storage space of the target data block is greater than a threshold value according to the instruction;
[0100] If the free storage space of the target data block is less than the threshold, determining the size of the storage space required to be expanded for the target data block;
[0101] The storage space of the target data block is expanded according to the size of the storage space required to be expanded for the target data block.
[0102] In addition, the server may also execute other steps in the storage space expansion method described above.
[0103] Computer program code for performing the operations of the present disclosure may be written in one or more programming languages or a combination thereof, including, but not limited to, 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 cases involving 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., through the Internet using an Internet service provider).
[0104] 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.
[0105] 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.
[0106] 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.
[0107] 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.
[0108] It should be noted that, in this article, relational terms such as "first" and "second" are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.
[0109] The above description is only a specific embodiment of the present disclosure, so that those skilled in the art can understand or implement the present disclosure. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present disclosure. Therefore, the present disclosure will not be limited to the embodiments described herein, but will conform to the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A storage space expansion method, characterized in that: The method comprises: receiving an instruction sent by a terminal, the instruction being processed by a first process, the instruction including identification information of a target data block and an operation performed on the target data block; Determine whether the free storage space of the target data block is greater than a threshold value according to the instruction; If the free storage space of the target data block is less than the threshold, determining the size of the storage space required to be expanded for the target data block; Expanding the storage space of the target data block according to the size of the storage space required to be expanded for the target data block; The step of determining the storage space size required to expand the target data block includes: Predicting the storage space size required for the target data block to be expanded by the number of waiting processes in the waiting queue, wherein the number of waiting processes in the waiting queue is read from the shared memory; Comparing the predicted storage space size required for expansion of the target data block with an upper limit of the expansion storage space, and taking the smaller value of the predicted storage space size required for expansion of the target data block and the upper limit of the expansion storage space as the storage space size required for expansion of the target data block; The predicted storage space size required for the target data block to be expanded is determined based on the product of the number of process waits, a preset base number, and the size of a data block.
2. The method according to claim 1, characterized in that The step of determining whether the available storage space of the target data block is greater than a threshold value according to the instruction includes: determining the threshold value according to the instruction; Based on the threshold and the free storage space of the target data block, it is determined whether the free storage space of the target data block is greater than the threshold.
3. The method according to claim 1, characterized in that If the free storage space of the target data block is less than a threshold, determining the size of the storage space required to be expanded for the target data block includes: If the free storage space of the target data block is less than a threshold, the target data block accessed by the instruction is locked, so that after the locking is successful, the second process behind the first process in the waiting queue cannot perform operations on the target data block; Detecting whether a third process has extended the target data block; If no third process is used to expand the target data block, the size of the storage space required to expand the target data block is determined.
4. The method according to claim 3, characterized in that: After the storage space of the target data block is expanded according to the storage space size required to be expanded by the target data block, the method further comprises: The target data block accessed by the instruction is unlocked.
5. A storage space expansion device, characterized in that: include: A receiving module, configured to receive an instruction sent by a terminal, wherein the instruction is processed by a first process and includes identification information of a target data block and an operation performed on the target data block; A first determination module, configured to determine whether the free storage space of the target data block is greater than a threshold value according to the instruction; A second determination module, configured to determine the size of the storage space required to be expanded for the target data block when the free storage space of the target data block is less than a threshold; An expansion module, used for expanding the storage space of the target data block according to the size of the storage space required to be expanded by the target data block; When determining the storage space size required to expand the target data block, the second determination module is specifically used to: Predicting the storage space size required for the target data block to be expanded by the number of waiting processes in the waiting queue, wherein the number of waiting processes in the waiting queue is read from the shared memory; Comparing the predicted storage space size required for expansion of the target data block with an upper limit of the expansion storage space, and taking the smaller value of the predicted storage space size required for expansion of the target data block and the upper limit of the expansion storage space as the storage space size required for expansion of the target data block; The predicted storage space size required for the target data block to be expanded is determined based on the product of the number of process waits, a preset base number, and the size of a data block.
6. The device according to claim 5, characterized in that When determining whether the free storage space of the target data block is greater than a threshold according to the instruction, the first determining module is specifically used to: determining the threshold value according to the instruction; Based on the threshold and the free storage space of the target data block, it is determined whether the free storage space of the target data block is greater than the threshold.
7. The device according to claim 5, characterized in that The second determination module includes a processing unit, a detection unit and a determination unit; A processing unit, configured to lock the target data block accessed by the instruction when the free storage space of the target data block is less than a threshold value, so that after the locking is successful, a second process behind the first process in the waiting queue cannot perform operations on the target data block; a detection unit, configured to detect whether a third process has extended the target data block; The determining unit is used to determine the size of the storage space required to expand the target data block when no third process expands the target data block.
8. A server, characterized in that: include: Memory; processor; as well as Computer programs; The computer program is stored in the memory and is configured to be executed by the processor to implement the method according to any one of claims 1 to 4.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 4 is implemented.
Citation Information
Patent Citations
Data processing method and system, electronic equipment and storage medium
CN111880734A
