A method for handling abnormalities and a related device

The exception handling process and status of the target service are detected through the service self-check component, which avoids the mutual exclusion problem of resource access, improves the file system operation experience, and solves the mutual exclusion problem when the SMB service is restarted.

CN113687929BActive Publication Date: 2024-08-20JINAN INSPUR DATA TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202110975231.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-08-24
Publication Date
2024-08-20
Estimated Expiration
2041-08-24

AI Technical Summary

Technical Problem

When configuring the smb service, the restart operation of ctdb and management software may cause resource access mutual exclusion problems, reducing the experience of operating the file system.

Method used

Use the service self-check component to detect whether there is an exception handling process and status information in the target service, avoid simultaneous exception handling operations, and ensure that exception handling is only performed on the target service when necessary.

Benefits of technology

It effectively avoids resource access mutual exclusion issues, improves the experience of operating the file system, and prevents unnecessary restart operations.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113687929B_ABST
    Figure CN113687929B_ABST
Patent Text Reader

Abstract

The present application discloses an exception handling method, including: when a service self-check component detects an exception in a target service, determining whether there is an exception handling process that performs operations on the target service; when there is no exception handling process, obtaining the status information of the target service; when the status information is inactive, performing an exception handling operation on the target service through the service self-check component. By determining whether there is an exception handling process that performs operations on the target service when the service self-check component detects an exception, and determining whether the status information is inactive when there is no exception handling process, it is avoided that there are exception handling processes that perform operations at the same time, and it is also avoided that other processes have just completed processing the target service and do not need to perform exception processing on the target service again, avoiding mutual exclusion problems, and improving the experience of operating the file system. The present application also discloses an exception handling device, a server, and a computer-readable storage medium, which have the above beneficial effects.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to an exception handling method, an exception handling device, a server, and a computer-readable storage medium. Background Art

[0002] With the continuous development of data storage technology, more and more functions have appeared in the file system to cope with complex usage scenarios. Among them, SMB (Server Messages Block) is a component of the Ceph (distributed file system) file system, which provides SMB services to share directories and files on the file system. Taking the Windows client as an example, you can mount the SMB shared folder by mapping a network drive and map it to a Windows network disk.

[0003] In the related art, when configuring the smb service on the management software, a restart smb command will be issued. At this time, the restart is divided into two processes: stop and start. When the stop is executed, it happens that ctdb (Cluster TrivialDatabase) monitors that smb is in the stop state, so ctdb will also execute restart smb to start the smb service. When ctdb executes stop, the management software has just executed start smb, so the start of the management software will be cancelled, resulting in an error report on the management software that the restart smb failed. Similarly, when ctdb is restarting the smb service, if the management software happens to issue a restart smb command, ctdb will also report an error that the restart smb failed. It can be seen that in the corresponding management software, it is easy for multiple resources to access resources and mutual exclusion problems occur, which reduces the experience of operating the file system.

[0004] Therefore, how to avoid the mutual exclusion problem of accessing resources is a key issue that technical personnel in this field are concerned about. Summary of the invention

[0005] The purpose of this application is to provide an exception handling method, an exception handling device, a server, and a computer-readable storage medium to avoid mutual exclusion problems during exception handling and improve the experience of operating a file system.

[0006] In order to solve the above technical problems, the present application provides an exception handling method, including:

[0007] When the service self-check component detects that the target service is abnormal, it determines whether there is an abnormality handling process that performs operations on the target service;

[0008] When the exception handling process does not exist, obtaining status information of the target service;

[0009] When the status information is inactive, an exception handling operation is performed on the target service through the service self-check component.

[0010] Optionally, when the service self-check component detects that an exception occurs in the target service, determining whether there is an exception handling process that performs an operation on the target service includes:

[0011] When the service self-check component detects that the port of the target service is not occupied, it is determined whether there is the exception handling process issued by the management software.

[0012] Optionally, when the service self-check component detects that the port of the target service is not occupied, determining whether there is the exception handling process sent by the management software includes:

[0013] When the service self-check component detects that the port of the target service is not occupied, it is determined whether there is an ism_pid process issued by the management software.

[0014] Optionally, also include:

[0015] When the exception handling process exists, a termination operation is performed on the exception handling operation of the service self-check component, and exception handling is performed on the target service through the exception handling process.

[0016] Optionally, when the exception handling process does not exist, obtaining the status information of the target service includes:

[0017] When the exception handling process does not exist, the status information of the target service is obtained through a query command.

[0018] Optionally, when the status information is inactive, performing an exception handling operation on the target service through the service self-check component includes:

[0019] When the status information is inactive, a restart operation is performed on the target service through the service self-check component.

[0020] Optionally, also include:

[0021] When the state information is active, a termination operation is performed on the exception handling operation of the service self-check component.

[0022] The present application also provides an exception handling device, comprising:

[0023] A process determination module is used to determine whether there is an exception handling process that performs operations on the target service when the service self-check component detects that the target service is abnormal;

[0024] A status acquisition module, used for acquiring status information of the target service when the exception handling process does not exist;

[0025] The exception handling module is used to perform an exception handling operation on the target service through the service self-check component when the status information is inactive.

[0026] The present application also provides a server, comprising:

[0027] Memory for storing computer programs;

[0028] A processor is used to implement the steps of the above-mentioned exception handling method when executing the computer program.

[0029] The present application also provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the exception handling method described above are implemented.

[0030] An exception handling method provided by the present application includes: when a service self-check component detects that an exception occurs in a target service, determining whether there is an exception handling process that performs operations on the target service; when the exception handling process does not exist, obtaining status information of the target service; when the status information is inactive, performing exception handling operations on the target service through the service self-check component.

[0031] When the service self-check component detects an exception, it determines whether there is an exception handling process that performs operations on the target service, that is, determines whether there are other processes performing exception handling at this time, and determines whether the status information is inactive when there is no exception handling process, and finally performs the exception handling operation. This avoids the existence of exception handling processes performing operations at the same time, and also avoids the situation where other processes have just completed processing the target service and do not need to perform exception handling on the target service again. Ultimately, this avoids the mutual exclusion problem and improves the experience of operating the file system.

[0032] The present application also provides an exception handling device, a server, and a computer-readable storage medium, which have the above beneficial effects and are not elaborated here. BRIEF DESCRIPTION OF THE DRAWINGS

[0033] In order to more clearly illustrate the embodiments of the present application 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, the drawings described below are only embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying any creative work.

[0034] Figure 1 A flowchart of an exception handling method provided in an embodiment of the present application;

[0035] Figure 2 A schematic diagram of the structure of an exception handling device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0036] The core of this application is to provide an exception handling method, an exception handling device, a server and a computer-readable storage medium to avoid mutual exclusion problems during exception handling and improve the experience of operating a file system.

[0037] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0038] In the related art, when configuring the smb service on the management software, a restart smb command will be issued. At this time, the restart is divided into two processes: stop and start. When the stop is executed, it happens that ctdb (Cluster TrivialDatabase) monitors that smb is in the stop state, so ctdb will also execute restart smb to start the smb service. When ctdb executes stop, the management software has just executed start smb, so the start of the management software will be cancelled, resulting in an error report on the management software that the restart smb failed. Similarly, when ctdb is restarting the smb service, if the management software happens to issue a restart smb command, ctdb will also report an error that the restart smb failed. It can be seen that in the corresponding management software, it is easy for multiple resources to access resources and mutual exclusion problems occur, which reduces the experience of operating the file system.

[0039] Therefore, the present application provides an exception handling method, which, when the service self-check component detects an exception, determines whether there is an exception handling process that performs operations on the target service, that is, determines whether there are other processes performing exception handling at this time, and determines whether the status information is inactive when there is no exception handling process, and finally performs the exception handling operation, thereby avoiding the existence of exception handling processes performing operations at the same time, and also avoiding the situation where other processes have just completed processing the target service and do not need to perform exception handling on the target service again, ultimately avoiding the mutual exclusion problem and improving the experience of operating the file system.

[0040] An exception handling method provided by the present application is described below through an embodiment.

[0041] Please refer to Figure 1 , Figure 1 A flowchart of an exception handling method provided in an embodiment of the present application.

[0042] In this embodiment, the method may include:

[0043] S101, when the service self-check component detects that a target service is abnormal, it is determined whether there is an abnormality handling process that performs operations on the target service;

[0044] It can be seen that this step is intended to determine whether there is an exception handling process that performs operations on the target service when the service self-check component detects that the target service is abnormal. In other words, the service self-check component determines whether the target service is abnormal. When it is determined that the target service is abnormal, in order to avoid the problem of operation failure caused by operating the target service at the same time.

[0045] Furthermore, this step may include:

[0046] When the service self-check component detects that the port of the target service is not occupied, it determines whether there is an exception handling process issued by the management software.

[0047] It can be seen that this optional solution mainly further explains how to detect and judge. In this optional solution, when the service self-check component detects that the target port is not occupied, it determines whether there is an exception handling process issued by the management software. Therefore, it can be imagined that this optional solution needs to check whether the port of the target service is occupied. If so, it means that the target service is normal and there is no abnormality. If not, it means that there is an abnormality in the target service.

[0048] For example, in the smb service, when the smb service is started, ports 445 and 139 are in an occupied state. Therefore, ctdb executes a monitor event every 5 seconds. In the monitor event, ctdb checktcpport 445 is called to detect whether the smb port 445 is occupied. The specific principle is to try to bind port 445. If the binding is successful, it means that the port is not occupied. If the binding fails, it means that the port is occupied by the smb service. If port 445 is occupied, it means that the smb service is normal. Otherwise, if port 445 is not occupied, it means that the smb service is abnormal.

[0049] Furthermore, the above optional solutions may also include:

[0050] When the service self-check component detects that the port of the target service is not occupied, it determines whether there is an ism_pid process sent by the management software.

[0051] It can be seen that this optional solution mainly explains how to make a judgment. In this optional solution, when the service self-check component detects that the port of the target service is not occupied, it is determined whether there is an ism_pid process issued by the management software. Among them, the ism_pid process is the process of the management software to restart the smb.

[0052] S102, when there is no exception handling process, obtaining status information of the target service;

[0053] Based on S101, this step aims to obtain the status information of the target service when there is no exception handling process.

[0054] That is to say, when there is no exception handling process, it is impossible to determine whether there is no problem in handling the exception of the target service at this time. It is also necessary to judge through the status information of the target service. That is, to judge whether the target service has just been handled by exception. Therefore, in this step, it is necessary to obtain the status information of the target service.

[0055] The status information is active or inactive. When the status information is active, it means that the target service has just been processed by exception and no exception processing is required. When the status information is inactive, it means that the target service has not yet been processed by the corresponding exception processing operation and needs to be processed.

[0056] Furthermore, this step may include:

[0057] When there is no exception handling process, the status information of the target service is obtained through the query command.

[0058] It can be seen that this optional solution mainly explains how to obtain status information. In this optional solution, when there is no exception handling process, the status information of the target service is obtained through a query command. Among them, the query command used can be any query command provided by the prior art, and no specific limitation is made here.

[0059] In addition, this embodiment may also include:

[0060] When an exception handling process exists, a termination operation is performed on the exception handling operation of the service self-check component, and exception handling is performed on the target service through the exception handling process.

[0061] It can be seen that this optional solution mainly explains how to handle when there is an exception handling process. In this optional solution, when the exception handling process exists, it means that there is a process that handles the target service at this time, and the service self-check component does not need to perform exception handling anymore, and the related operations of the service self-check component need to be stopped.

[0062] S103: When the status information is inactive, an exception handling operation is performed on the target service through the service self-check component.

[0063] Based on S102, this step aims to perform an exception handling operation on the target service through the service self-check component when the status information is inactive.

[0064] Furthermore, this step may include:

[0065] When the status information is inactive, a restart operation is performed on the target service through the service self-check component.

[0066] It can be seen that this optional solution is mainly to explain how to handle exceptions. In this optional solution, when the state information is inactive, the target service is restarted through the service self-check component.

[0067] In addition, this embodiment may also include:

[0068] When the state information is active, a termination operation is performed on the exception handling operation of the service introspection component.

[0069] It can be seen that this optional solution mainly explains how to handle when the status information is active. When the status information is active, it means that the exception handling process has just finished the exception handling of the target service and needs to perform exception handling again, so the relevant operations can be terminated.

[0070] In summary, this embodiment determines whether there is an exception handling process that performs operations on the target service when the service self-check component detects an exception, that is, determines whether there are other processes performing exception handling at this time, and determines whether the status information is inactive when there is no exception handling process, and finally performs the exception handling operation. This avoids the existence of exception handling processes performing operations at the same time, and also avoids the situation where other processes have just completed processing the target service and do not need to perform exception handling on the target service again. Ultimately, this avoids the mutual exclusion problem and improves the experience of operating the file system.

[0071] The following is a specific example to further illustrate an exception handling method provided by the present application.

[0072] In this embodiment, the method may include:

[0073] Step 1: When the service self-check component detects that the port of the target service is not occupied, it determines whether there is an ism_pid process issued by the management software;

[0074] Step 2: when there is an exception handling process, terminate the exception handling operation of the service self-check component, and perform exception handling on the target service through the exception handling process;

[0075] Step 3: When there is no exception handling process, obtain the status information of the target service through a query command;

[0076] Step 4: When the status information is inactive, restart the target service through the service self-check component;

[0077] Step 5: When the status information is active, a termination operation is performed on the exception handling operation of the service self-check component.

[0078] Based on the above steps, in a specific application scenario, the above operation steps can be applied to the technical field of ctdb processing smb exceptions.

[0079] The steps of this embodiment may include:

[0080] Step 1: When ctdb detects an abnormality in the smb service, check whether the process ism_pid of the management software start or restart smb exists;

[0081] Step 2: If the ism_pid process exists, the ctdb restart smb process automatically exits, and the management software restart smb process continues;

[0082] Step 3: If the ism_pid process does not exist, it means that either the ism_pid process has just exited or no process has started smb. At this time, you need to use the systemctl status smb command to check the smb status for further judgment;

[0083] Step 4: If the smb status is active, it means that the ism_pid process has just exited and smb has been started. ctdb does not need to restart smb. Then ctdb is responsible for restarting the smb child process and exiting.

[0084] Step 5: If the smb status is inactive, it means that the ism_pid process has never appeared and the smb status is still abnormal. In this case, ctdb needs to restart the smb service.

[0085] It can be seen that this embodiment determines whether there is an exception handling process that performs operations on the target service when the service self-check component detects an exception, that is, determines whether there are other processes performing exception handling at this time, and determines whether the status information is inactive when there is no exception handling process, and finally performs the exception handling operation. This avoids the existence of exception handling processes performing operations at the same time, and also avoids the situation where other processes have just completed processing the target service and do not need to perform exception handling on the target service again, ultimately avoiding mutual exclusion problems and improving the experience of operating the file system.

[0086] The following is an introduction to the exception handling device provided in the embodiment of the present application. The exception handling device described below and the exception handling method described above can be referenced to each other.

[0087] Please refer to Figure 2 , Figure 2 A schematic diagram of the structure of an exception handling device provided in an embodiment of the present application.

[0088] In this embodiment, the device may include:

[0089] The process determination module 100 is used to determine whether there is an exception handling process that performs operations on the target service when the service self-check component detects that the target service is abnormal;

[0090] The status acquisition module 200 is used to acquire the status information of the target service when there is no exception handling process;

[0091] The exception handling module 300 is used to perform an exception handling operation on the target service through the service self-check component when the state information is inactive.

[0092] Optionally, the process determination module 100 is specifically used to determine whether there is an exception handling process sent by the management software when the service self-check component detects that the port of the target service is not occupied.

[0093] Optionally, the process determination module 100 is specifically used to determine whether there is an ism_pid process sent by the management software when the service self-check component detects that the port of the target service is not occupied.

[0094] Optionally, the device may further include:

[0095] The first termination module is used to terminate the exception handling operation of the service self-check component when there is an exception handling process, and perform exception handling on the target service through the exception handling process.

[0096] Optionally, the status acquisition module 200 is specifically used to acquire the status information of the target service through a query command when there is no exception handling process.

[0097] Optionally, the exception handling module 300 is specifically configured to, when the status information is inactive, perform a restart operation on the target service through a service self-check component.

[0098] Optionally, the device may further include:

[0099] The second termination module is used to perform a termination operation on the exception handling operation of the service self-check component when the state information is active.

[0100] The present application also provides a server, including:

[0101] Memory for storing computer programs;

[0102] A processor is used to implement the steps of the exception handling method described in the above embodiment when executing the computer program.

[0103] An embodiment of the present application further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the exception handling method described in the above embodiment are implemented.

[0104] The various embodiments in the specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part description.

[0105] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in the above description according to function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.

[0106] The steps of the method or algorithm described in conjunction with the embodiments disclosed herein may be implemented directly using hardware, a software module executed by a processor, or a combination of the two. The software module may be placed in a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.

[0107] The above is a detailed introduction to an exception handling method, an exception handling device, a server, and a computer-readable storage medium provided by the present application. Specific examples are used herein to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method and core idea of ​​the present application. It should be pointed out that for ordinary technicians in this technical field, without departing from the principles of the present application, several improvements and modifications can be made to the present application, and these improvements and modifications also fall within the scope of protection of the claims of the present application.

Claims

1. An exception handling method, characterized in that: Applicable to the scenarios where ctdb handles SMB exceptions, including: When the service self-check component detects that an abnormality occurs in the target service, it is determined whether there is an abnormality handling process that performs operations on the target service; the service self-check component is ctdb, and the target service is smb service; When the exception handling process does not exist, the state information of the target service is obtained; wherein the state information includes active and inactive, and when the state information is active, it is used to indicate that the exception handling of the target service has just been completed, and when the state information is inactive, it is used to indicate that the corresponding exception handling operation has not been executed on the target service; When the status information is inactive, performing an exception handling operation on the target service through the service self-check component; When the service self-check component detects that an abnormality occurs in the target service, it is determined whether there is an abnormality handling process that performs an operation on the target service, including: When the service self-check component detects that the port of the target service is not occupied, determining whether there is the exception handling process issued by the management software; When the service self-check component detects that the port of the target service is not occupied, determining whether there is the exception handling process issued by the management software includes: When the service self-check component detects that the port of the target service is not occupied, it determines whether there is an ism_pid process issued by the management software; Among them, it also includes: When the exception handling process exists, terminate the exception handling operation of the service self-check component, and perform exception handling on the target service through the exception handling process; Wherein, when the state information is inactive, performing an exception handling operation on the target service through the service self-check component includes: When the status information is inactive, performing a restart operation on the target service through the service self-check component; Among them, it also includes: When the state information is active, a termination operation is performed on the exception handling operation of the service self-check component.

2. The exception handling method according to claim 1, characterized in that: When the exception handling process does not exist, obtaining the status information of the target service includes: When the exception handling process does not exist, the status information of the target service is obtained through a query command.

3. An exception handling device, characterized in that: Applicable to the scenarios where ctdb handles SMB exceptions, including: A process judgment module, used for judging whether there is an exception handling process that performs operations on the target service when the service self-check component detects that the target service is abnormal; the service self-check component is ctdb, and the target service is smb service; A status acquisition module, used for acquiring status information of the target service when the exception handling process does not exist; wherein the status information includes active and inactive, and when the status information is active, it is used to indicate that the exception handling of the target service has just been completed, and when the status information is inactive, it is used to indicate that the corresponding exception handling operation has not been executed on the target service; An exception handling module, used for performing an exception handling operation on the target service through the service self-check component when the status information is inactive; The process determination module is specifically used to determine whether there is an exception handling process issued by the management software when the service self-check component detects that the port of the target service is not occupied; The process determination module is specifically used to determine whether there is an ism_pid process issued by the management software when the service self-check component detects that the port of the target service is not occupied; The first termination module is used to terminate the exception handling operation of the service self-check component when there is an exception handling process, and perform exception handling on the target service through the exception handling process; Wherein, the exception handling module is specifically used to perform a restart operation on the target service through the service self-check component when the status information is inactive; Wherein, the second termination module is used to perform a termination operation on the exception handling operation of the service self-check component when the status information is active.

4. A server, characterized in that: include: Memory for storing computer programs; A processor, configured to implement the steps of the exception handling method according to any one of claims 1 to 2 when executing the computer program.

5. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the exception handling method according to any one of claims 1 to 2 are implemented.