Memory application method and device, electronic equipment and medium

文档序号:970846 发布日期:2020-11-03 浏览:4次 中文

阅读说明:本技术 一种内存申请方法、装置、电子设备和介质 (Memory application method and device, electronic equipment and medium ) 是由 侯红生 刘文志 于 2020-07-30 设计创作,主要内容包括:本申请提供了一种内存申请方法、装置、电子设备和介质,该方法包括:在集群中的两节点同时故障后的恢复过程中,本地节点判断对端节点是否发生故障;若对端节点发生故障,则创建与对端节点对应第一缓存分区;根据第一缓存分区发送第一内存申请请求至存储设备,以便存储设备为第一缓存分区分配第一内存。本申请集群中的两节点同时故障后的恢复过程中,本地节点在感知对端节点二次故障后,在本地节点创建对端节点的第一缓存分区并为申请第一内存,能够在对端节点二次故障后,本地节点能够代替对端节点申请到内存,保证了缓存分区不丢失,避免了由于存在单分区申请不到内存的情况造成的删除分区造成故障的问题。(The application provides a memory application method, a memory application device, an electronic device and a medium, wherein the method comprises the following steps: in the recovery process after two nodes in the cluster simultaneously fail, the local node judges whether the opposite node fails; if the opposite end node has a fault, a first cache partition corresponding to the opposite end node is established; and sending a first memory application request to the storage device according to the first cache partition so that the storage device allocates a first memory for the first cache partition. In the recovery process after two nodes in the cluster simultaneously fail, after sensing the secondary failure of the opposite end node, the local node creates a first cache partition of the opposite end node and applies for a first memory, after the secondary failure of the opposite end node, the local node can replace the opposite end node to apply for the memory, so that the cache partition is not lost, and the problem that the failure is caused by deleting the partition due to the fact that the memory cannot be applied by a single partition is avoided.)

1. A memory application method, comprising:

in the recovery process after two nodes in the cluster simultaneously fail, the local node judges whether the opposite node fails;

if the opposite end node fails, a first cache partition corresponding to the opposite end node is established;

and sending a first memory application request to a storage device according to the first cache partition so that the storage device allocates a first memory to the first cache partition.

2. The memory application method of claim 1, further comprising:

creating a second cache partition;

and sending a second memory application request to the storage device according to the second cache partition so that the storage device allocates a second memory to the second cache partition.

3. The memory application method according to claim 1, wherein the determining, by the local node, whether the peer node has a failure includes:

judging whether the information of the opposite end node is received within preset time;

and if the information of the opposite end node is not received, determining that the opposite end node fails.

4. The memory application method according to claim 1, wherein after sending the first memory application request to the storage device according to the first cache partition, the method further comprises:

and after the opposite end node is added into the cluster, the local node deletes the first cache partition so as to enable the opposite end node to establish the cache partition and apply for a corresponding memory.

5. The memory application method according to claim 1, wherein the creating a first cache partition corresponding to the peer node if the peer node fails comprises:

if the opposite end node fails, receiving an intermediate state value sent by the opposite end node;

modifying the intermediate state value, and creating the first cache partition corresponding to the opposite end node;

correspondingly, the sending a first memory application request to a storage device according to the first cache partition so that the storage device allocates a first memory to the first cache partition includes:

and sending the first memory application request to the storage device according to the first cache partition and the modified intermediate state value, so that the storage device allocates the first memory to the first cache partition.

6. The memory application method of claim 5, wherein the allocating, by the storage device, the first memory for the first cache partition comprises:

the storage device judges whether the opposite end node creates a cache partition;

if the opposite end node creates the cache partition, judging whether the flag bit of the opposite end node is recovered according to the modified intermediate state value;

and if the flag bit of the opposite end node is recovered, allocating the first cache to the first cache partition.

7. A memory application apparatus, comprising:

the judging module is used for judging whether the opposite end node fails or not by the local node in the recovery process after two nodes in the cluster fail simultaneously;

a first cache partition creating module, configured to create a first cache partition corresponding to the peer node if the peer node fails;

and the request sending module is used for sending a first memory application request to the storage device according to the first cache partition so that the storage device can allocate a first memory to the first cache partition.

8. The memory application device of claim 7, further comprising:

the second cache partition creating module is used for creating a second cache partition;

and the second memory application request sending module is configured to send a second memory application request to the storage device according to the second cache partition, so that the storage device allocates a second memory to the second cache partition.

9. An electronic device, comprising:

a memory for storing a computer program;

a processor for implementing the steps of the memory application method according to any one of claims 1 to 5 when executing the computer program.

10. A computer-readable storage medium, having stored thereon a computer program which, when being executed by a processor, carries out the steps of the memory application method according to any one of claims 1 to 5.

Technical Field

The present application relates to the field of memory application technologies, and in particular, to a memory application method and apparatus, an electronic device, and a computer-readable storage medium.

Background

For the multi-control storage device, if neither node in the IO cluster is in the cluster, a secondary failure recovery process is triggered. In the secondary failure recovery process, if a certain node triggers another failure again in the recovery process, for example, a lease expires, the SSD single partition may not apply for the memory, so that a failure occurs when the partition is deleted, and the acceleration function of the SSD cannot be normally used.

Therefore, how to provide a solution to the above technical problem is a problem that needs to be solved by those skilled in the art.

Disclosure of Invention

The application aims to provide a memory application method, a memory application device, electronic equipment and a computer readable storage medium, after a secondary fault of an opposite end node, a local node can replace the opposite end node to apply for a memory, and the problem that a fault is caused by deleting a partition due to the fact that a single partition cannot apply for the memory is solved. The specific scheme is as follows:

the application provides a memory application method, which comprises the following steps:

in the recovery process after two nodes in the cluster simultaneously fail, the local node judges whether the opposite node fails;

if the opposite end node fails, a first cache partition corresponding to the opposite end node is established;

and sending a first memory application request to a storage device according to the first cache partition so that the storage device allocates a first memory to the first cache partition.

Preferably, the method further comprises the following steps:

creating a second cache partition;

and sending a second memory application request to the storage device according to the second cache partition so that the storage device allocates a second memory to the second cache partition.

Preferably, the determining, by the local node, whether the peer node fails includes:

judging whether the information of the opposite end node is received within preset time;

and if the information of the opposite end node is not received, determining that the opposite end node fails.

Preferably, after the sending the first memory application request to the storage device according to the first cache partition, the method further includes:

and after the opposite end node is added into the cluster, the local node deletes the first cache partition so as to enable the opposite end node to establish the cache partition and apply for a corresponding memory.

Preferably, if the opposite end node fails, creating a first cache partition corresponding to the opposite end node, including:

if the opposite end node fails, receiving an intermediate state value sent by the opposite end node;

modifying the intermediate state value, and creating the first cache partition corresponding to the opposite end node;

correspondingly, the sending a first memory application request to a storage device according to the first cache partition so that the storage device allocates a first memory to the first cache partition includes:

and sending the first memory application request to the storage device according to the first cache partition and the modified intermediate state value, so that the storage device allocates the first memory to the first cache partition.

Preferably, the allocating, by the storage device, the first memory for the first cache partition includes:

the storage device judges whether the opposite end node creates a cache partition;

if the opposite end node creates the cache partition, judging whether the flag bit of the opposite end node is recovered according to the modified intermediate state value;

and if the flag bit of the opposite end node is recovered, allocating the first cache to the first cache partition.

The application provides a memory application device, includes:

the judging module is used for judging whether the opposite end node fails or not by the local node in the recovery process after two nodes in the cluster fail simultaneously;

a first cache partition creating module, configured to create a first cache partition corresponding to the peer node if the peer node fails;

and the request sending module is used for sending a first memory application request to the storage device according to the first cache partition so that the storage device can allocate a first memory to the first cache partition.

Preferably, the method further comprises the following steps:

the second cache partition creating module is used for creating a second cache partition;

and the second memory application request sending module is configured to send a second memory application request to the storage device according to the second cache partition, so that the storage device allocates a second memory to the second cache partition.

The application provides an electronic device, including:

a memory for storing a computer program;

and the processor is used for realizing the steps of the memory application method when executing the computer program.

The present application provides a computer readable storage medium having stored thereon a computer program which, when executed by a processor, implements the steps of the memory application method as described above.

The application provides a memory application method, which comprises the following steps: in the recovery process after two nodes in the cluster simultaneously fail, the local node judges whether the opposite node fails; if the opposite end node has a fault, a first cache partition corresponding to the opposite end node is established; and sending a first memory application request to the storage device according to the first cache partition so that the storage device allocates a first memory for the first cache partition.

It can be seen that, in the recovery process after two nodes in the cluster fail at the same time, after the local node senses the secondary failure of the opposite node, the local node creates the first cache partition of the opposite node and applies for the first memory, and after the secondary failure of the opposite node, the local node can replace the opposite node to apply for the memory, so that the cache partition is not lost, and the problem that the failure is caused by deleting the partition due to the fact that the memory cannot be applied by a single partition is avoided.

The application also provides a memory application device, an electronic device and a computer readable storage medium, which all have the beneficial effects and are not described herein again.

Drawings

In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings needed to be used in the description of the embodiments or the prior art will be briefly introduced below, it is obvious that the drawings in the following description are only embodiments of the present application, and for those skilled in the art, other drawings can be obtained according to the provided drawings without creative efforts.

Fig. 1 is a flowchart of a memory application method according to an embodiment of the present disclosure;

fig. 2 is a schematic structural diagram of a memory application device according to an embodiment of the present disclosure;

fig. 3 is a schematic structural diagram of an electronic device according to an embodiment of the present application.

Detailed Description

In order to make the objects, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are some embodiments of the present application, but not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.

For the multi-control storage device, if neither node in the IO cluster is in the cluster, a secondary failure recovery process is triggered. In the secondary failure recovery process, if a certain node triggers another failure again in the recovery process, for example, a lease expires, the SSD single partition may not apply for the memory, so that a failure occurs when the partition is deleted, and the acceleration function of the SSD cannot be normally used.

Based on the above technical problems, this embodiment provides a memory application method, where after a secondary failure of an opposite end node, a local node can apply for a memory instead of the opposite end node, so as to ensure that a cache partition is not lost, and avoid a problem of a failure caused by deleting a partition due to a situation that a single partition cannot apply for a memory, specifically refer to fig. 1, where fig. 1 is a flowchart of a memory application method provided in this embodiment of the present application, and specifically includes:

s101, in the recovery process after two nodes in a cluster simultaneously fail, a local node judges whether an opposite node fails;

in the multi-control storage device, a cluster, i.e., an IO cluster, includes multiple pairs of nodes and storage devices, the nodes all exist in pairs, the node refers to a node having a single SSD partition, and the storage devices allocate memories for the nodes. When two nodes in the cluster are not in the cluster, namely two nodes (including the local node and the opposite node) fail to exit the cluster at the same time. At this time, a T2 recovery flow is triggered, in a T2 recovery flow, that is, in a recovery process after two nodes in a cluster fail at the same time, a local node determines whether an opposite node fails, and at this time, the local node is defaulted to complete failure recovery, and no failure occurs again.

It can be understood that the correspondent node starts other failures again in the node recovery process, and a secondary failure or multiple failures are generated, the failure includes but is not limited to lease timeout, and at this time, the SSD single partition cannot apply for the memory.

The embodiment does not limit the manner of judging whether the end node fails, and the user can perform self-defined setting as long as the purpose of the embodiment can be achieved.

In one implementation, the determining, by the local node, whether the correspondent node fails includes: judging whether the information of the opposite end node is received within the preset time; and if the information of the opposite end node is not received, determining that the opposite end node fails.

The local node can communicate with the opposite node at regular time, if the information of the opposite node is received within the preset time, the opposite node is determined to be recovered to be normal, and if the information of the opposite node is not received within the preset time, the opposite node is determined to be in fault. The preset time is not limited in this embodiment, and may be 5s, 10s or other times as long as the purpose of this embodiment can be achieved.

In another implementation, the determining, by the local node, whether the correspondent node fails includes: and acquiring a state list of each node issued by the storage device, and determining whether the opposite node fails according to the state list of each node.

S102, if the opposite end node fails, a first cache partition corresponding to the opposite end node is established;

if the opposite end node fails, the local node creates a first cache partition corresponding to the opposite end node.

If the opposite end node has no fault, the local node establishes the cache partition of the local node and applies for the memory, and the opposite end node establishes the cache partition of the opposite end node and applies for the memory.

S103, sending a first memory application request to the storage device according to the first cache partition so that the storage device can allocate a first memory to the first cache partition.

The first memory application request corresponding to the first cache partition is sent to the storage device, so that the storage device allocates the first memory for the first cache partition. The storage device in this embodiment may specifically be a storage pool.

Specifically, in the process of triggering T2 recovery, a first flag bit is newly added to all existing SSD single partitions (storage nodes in the cluster), which indicates that memory is to be applied for these existing cache partitions in the recovery process. In the recovery process of the two nodes T2, when a node fails and exits the cluster again, the surviving node (local node) senses that another node (opposite node) exits the cluster, and will apply for the memory for the cache partition belonging to the opposite node according to the flag bit, and ensure that the total memory applied for the cache partition on the two nodes is unchanged. If the opposite end node can normally join the cluster, the memory does not need to be applied for the cache partition again; if the opposite node can not join the cluster, the surviving node (local node) newly builds the first cache partition belonging to the opposite node on the local node, and applies for the memory for the newly built first cache partition.

Specifically, if the opposite node fails, creating a first cache partition corresponding to the opposite node, including:

if the opposite end node fails, receiving an intermediate state value sent by the opposite end node;

modifying the intermediate state value, and creating a first cache partition corresponding to the opposite end node;

correspondingly, sending a first memory application request to the storage device according to the first cache partition so that the storage device allocates the first memory to the first cache partition, includes:

and sending a first memory application request to the storage device according to the first cache partition and the modified intermediate state value, so that the storage device allocates a first memory for the first cache partition.

If the opposite end node can normally join the cluster, additional adaptive flow is not needed; if the opposite end node can not normally join the cluster, the local node needs to newly add a processing flow to apply for the first memory corresponding to the opposite end node. Specifically, when the local node senses that the opposite node cannot normally join the cluster, the intermediate state value sent by the opposite node is forcibly modified to the state required by the application of the memory for the second cache partition in the node recovery process, so that the second cache partition (the second SSD single cache partition) of the local node and the newly-built first cache partition (the first SSD single cache partition) of the opposite node can both be applied to the memory.

Further, the allocating, by the storage device, the first memory for the first cache partition includes: the storage device judges whether a cache partition is created by the opposite end node; if the opposite end node creates a cache partition, judging whether the flag bit of the opposite end node is recovered according to the modified intermediate state value; and if the flag bit of the opposite node is recovered, allocating a first cache for the first cache partition. The mode of judging whether the opposite end node creates the cache partition can be judged through the existence mark, when the value in the existence mark is the target value, the cache partition is determined to be created, and if the value in the existence mark is not the target value, the cache partition is determined not to be created. The intermediate state value represents whether the re-creation is completed, if the re-creation is completed, the intermediate state value is changed from the previous false to true, and at the moment, the flag bit is determined to be recovered, and the storage device allocates a first cache for the first cache partition.

Further, after sending the first memory application request to the storage device according to the first cache partition, the method further includes: and after the opposite end node joins the cluster, the local node deletes the first cache partition so that the opposite end node creates the cache partition and applies for a corresponding memory.

After the opposite node is added into the cluster, the local first cache partition is deleted, the opposite node creates the cache partition and applies for the corresponding memory, wherein the size of the memory is the same as that of the first memory, so that the sum of the memory application amount of the local node and the memory application amount of the opposite node is ensured to be unchanged.

In summary, according to the method for applying for the memory by the SSD cache partition provided in this embodiment, when T2 is triggered to recover, a flag bit is added to all existing single partitions to indicate that a failure has occurred, and then if there is a node secondary failure in the recovery process of two nodes, the local node senses that the opposite node secondary failure has occurred, and the local node applies for the first memory for the first cache partition on the newly-built opposite node according to the flag bit; and finally, if the opposite end node can normally join the cluster, the local node can normally apply for the second cache partition on the local node to the second memory, and if the opposite end node cannot join the cluster, the local node needs to newly add a processing flow to apply for the second memory for the second cache partition corresponding to the opposite end node. The embodiment can ensure that the memory is applied for the cache partition on the node with the fault, the acceleration function of the SSD cache partition is normally used, and cluster faults cannot be caused by deleting the cache partition.

Based on the above technical solution, in the recovery process after two nodes in the cluster fail simultaneously, after the local node senses the secondary failure of the opposite node, the local node creates the first cache partition of the opposite node and applies for the first memory, and after the secondary failure of the opposite node, the local node can apply for the memory instead of the opposite node, so that the cache partition is not lost, and the problem that the failure is caused by deleting the partition due to the fact that the memory cannot be applied by a single partition is avoided.

Further, the method also comprises the following steps: creating a second cache partition; and sending a second memory application request to the storage device according to the second cache partition so that the storage device allocates a second memory for the second cache partition.

It is understood that the sum of the first memory and the second memory remains the same. After the local node establishes the first cache partition and the second cache partition, the local node comprises two SSD single partitions.

Referring to fig. 2, fig. 2 is a schematic structural diagram of a memory application apparatus provided in an embodiment of the present application, where the memory application apparatus described below and the memory application method described above may be referred to in a corresponding manner, and relevant modules are all disposed in a local node, and the memory application apparatus includes:

a determining module 201, configured to determine, by a local node, whether an opposite node fails in a recovery process after two nodes in a cluster fail at the same time;

a first cache partition creating module 202, configured to create, if the opposite node fails, a first cache partition corresponding to the opposite node;

the request sending module 203 is configured to send a first memory application request to the storage device according to the first cache partition, so that the storage device allocates the first memory for the first cache partition.

Preferably, the method further comprises the following steps:

the second cache partition creating module is used for creating a second cache partition;

and the second memory application request sending module is used for sending a second memory application request to the storage device according to the second cache partition, so that the storage device allocates a second memory for the second cache partition.

Preferably, the judging module 201 includes:

the judging unit is used for judging whether the information of the opposite node is received within the preset time;

and the fault determining unit is used for determining that the opposite end node has a fault if the information of the opposite end node is not received.

Preferably, the method further comprises the following steps:

and the deleting module is used for deleting the first cache partition by the local node after the opposite node is added into the cluster so as to enable the opposite node to establish the cache partition and apply for the corresponding memory.

Preferably, the first cache partition creation module 202 includes:

a receiving unit, configured to receive an intermediate state value sent by an opposite node if the opposite node fails;

the modification and creation unit is used for modifying the intermediate state value and creating a first cache partition corresponding to the opposite end node;

correspondingly, the request sending module 203 includes:

and the request sending unit is used for sending a first memory application request to the storage device according to the first cache partition and the modified intermediate state value so that the storage device can allocate a first memory for the first cache partition.

Since the embodiments of the apparatus portion and the method portion correspond to each other, please refer to the description of the embodiments of the method portion for the embodiments of the apparatus portion, which is not repeated here.

In the following, an electronic device provided by the embodiment of the present application is introduced, and the electronic device described below and the memory application method described above may be referred to correspondingly. Referring to fig. 3, fig. 3 is a schematic structural diagram of an electronic device according to an embodiment of the present disclosure, including:

a memory 300 for storing a computer program;

the processor 400 is configured to implement the steps of the memory application method as described above when executing the computer program.

The method can also comprise the following steps: input output interface 500, network port 600. The memory 300 includes a nonvolatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and computer-readable instructions, and the internal memory provides an environment for the operating system and the computer-readable instructions in the non-volatile storage medium to run. The processor 400 may be a Central Processing Unit (CPU), other general purpose processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), an off-the-shelf programmable gate array (FPGA) or other programmable logic device, discrete gate or transistor logic, discrete hardware components, etc. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like. The processor 400 provides computing and control capabilities for the electronic device, and when executing the computer program stored in the memory 300, may implement the steps of the memory application method. The input/output interface 500 is used for acquiring computer programs, parameters and instructions imported from the outside, and is controlled by the processor 400 to be stored in the memory 300. The input/output interface 500 may be connected to an input device for receiving parameters or instructions manually input by a user. The input device may be a touch layer covered on a display screen, or a button, a track ball or a touch pad arranged on a terminal shell, or a keyboard, a touch pad or a mouse, etc. Specifically, in this embodiment, a user may start the memory application method through the input/output interface 500. And a network port 600 for performing communication connection with each external terminal device. The communication technology adopted by the communication connection can be a wired communication technology or a wireless communication technology, such as a mobile high definition link (MHL) technology, a Universal Serial Bus (USB), a High Definition Multimedia Interface (HDMI), a wireless fidelity (WiFi), a bluetooth communication technology, a low power consumption bluetooth communication technology, an ieee802.11 s-based communication technology, and the like. Specifically, in this embodiment, under the condition of normal networking, the authentication may be implemented through interaction between the network port 600 and a mobile phone or a tablet computer.

Since the embodiment of the electronic device portion and the embodiment of the method portion correspond to each other, please refer to the description of the embodiment of the method portion for the embodiment of the electronic device portion, which is not repeated here.

The following describes a computer-readable storage medium provided by embodiments of the present application, and the computer-readable storage medium described below and the method described above may be referred to correspondingly.

The present embodiment provides a computer-readable storage medium, on which a computer program is stored, and the computer program, when executed by a processor, implements the steps of the above memory application method.

Since the embodiment of the computer-readable storage medium portion and the embodiment of the method portion correspond to each other, please refer to the description of the embodiment of the method portion for the embodiment of the computer-readable storage medium portion, which is not repeated here.

The embodiments are described in a progressive manner in the specification, each embodiment focuses on differences from other embodiments, and the same and similar parts among the embodiments are referred to each other. The device disclosed by the embodiment corresponds to the method disclosed by the embodiment, so that the description is simple, and the relevant points can be referred to the method part for description.

Those of skill would further appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, computer software, or combinations of both, and that the various illustrative components and steps have been described above generally in terms of their functionality in order to clearly illustrate this interchangeability of hardware and software. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.

The steps of a method or algorithm described in connection with the embodiments disclosed herein may be embodied directly in hardware, in a software module executed by a processor, or in a combination of the two. A software module may reside in Random Access Memory (RAM), memory, Read Only Memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.

The above detailed description is provided for a memory application method, an apparatus, an electronic device, and a computer-readable storage medium. The principles and embodiments of the present application are explained herein using specific examples, which are provided only to help understand the method and the core idea of the present application. It should be noted that, for those skilled in the art, it is possible to make several improvements and modifications to the present application without departing from the principle of the present application, and such improvements and modifications also fall within the scope of the claims of the present application.

11页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:多入口的全相联的高速缓冲存储器及数据管理方法

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!

技术分类