技术领域technical field
本发明涉及数据库领域,特别是涉及一种避免CTDB数据恢复时崩溃的方法、装置及介质。The invention relates to the field of databases, in particular to a method, device and medium for avoiding collapse during CTDB data restoration.
背景技术Background technique
Samba服务是在Linux或Unix系统上实现SMB协议的软件,能够实现客户端对服务器中数据的访问。The Samba service is software that implements the SMB protocol on a Linux or Unix system, enabling the client to access data in the server.
Samba服务会将运行时所使用或产生的用户数据以及工作记录存储至CTDB(临时数据库集群)中,CTDB往往被搭载于集群环境下的多个设备节点中,其中CTDB数据节点用于控制不同的TDB(临时数据库)的数据存取,CTDB主节点用于监控以及控制CTDB数据节点。当有CTDB主节点出现故障或发生改变时,往往需要恢复其对TDB整体化的记录。进行数据恢复的所需要的相关参数往往被注册在任务列表中。The Samba service will store user data and work records used or generated during runtime into CTDB (temporary database cluster). CTDB is often mounted on multiple device nodes in a cluster environment. CTDB data nodes are used to control different TDB (temporary database) data access, CTDB master node is used to monitor and control CTDB data node. When a CTDB master node fails or changes, it is often necessary to restore its records of TDB integration. Relevant parameters required for data recovery are often registered in the task list.
如图1所示的,是当前情况下进行数据恢复所参照的任务列表的结构,其中,srvid_handler_List为任务列表;srvid为任务ID(身份识别号);srvid_handler*h为记录数据恢复函数(pull_database_handler)与预先申请的内存空间地址(tevent_req*req)之间对应关系的映射链表,任务ID与映射链表之间存在唯一对应关系。在进行数据恢复时,CTDB主节点依照上述任务列表的结构根据任务ID查找对应的映射链表,并根据映射链表获悉对应的恢复函数以及内存空间地址,进而执行该恢复函数以将所获得的数据缓存至该内存空间地址。As shown in Figure 1, it is the structure of the task list referred to in the current situation for data recovery, wherein, srvid_handler_List is the task list; srvid is the task ID (identification number); srvid_handler*h is the record data recovery function (pull_database_handler) There is a mapping linked list corresponding to the pre-applied memory space address (tevent_req*req), and there is a unique corresponding relationship between the task ID and the mapped linked list. When performing data recovery, the CTDB master node searches for the corresponding mapping linked list according to the task ID according to the structure of the above task list, and learns the corresponding recovery function and memory space address according to the mapping linked list, and then executes the recovery function to cache the obtained data to the memory space address.
但是由于在恢复过程中,CTDB数据节点仍可能对TDB中数据进行IO操作,因此可能出现数据恢复错误的情况。在此情况下,CTDB主节点会释放内存空间地址(tevent_req*req)下用于缓存恢复数据的内存空间,当系统再次尝试数据恢复或对数据恢复任务进行相关监控时,将由于无法通过内存空间地址找到该内存空间而产生core文件,进而导致CTDB主节点的崩溃,难以保证CTDB进行数据恢复时的可靠性。However, during the recovery process, the CTDB data node may still perform IO operations on the data in the TDB, so data recovery errors may occur. In this case, the CTDB master node will release the memory space for caching and restoring data under the memory space address (tevent_req*req). The address finds the memory space to generate a core file, which in turn leads to the collapse of the CTDB master node, making it difficult to guarantee the reliability of CTDB for data recovery.
由此可见,提供一种避免CTDB数据恢复时崩溃的方法,以保证CTDB进行数据恢复时的可靠性,是本领域技术人员需要解决的问题。It can be seen that it is a problem to be solved by those skilled in the art to provide a method for avoiding the collapse of the CTDB during data recovery so as to ensure the reliability of the CTDB during data recovery.
发明内容Contents of the invention
本发明的目的是提供一种避免CTDB数据恢复时崩溃的方法、装置及介质,以保证CTDB进行数据恢复时的可靠性。The object of the present invention is to provide a method, device and medium for avoiding the collapse of CTDB data recovery, so as to ensure the reliability of CTDB data recovery.
为解决上述技术问题,本发明提供一种避免CTDB数据恢复时崩溃的方法,包括:In order to solve the problems of the technologies described above, the present invention provides a method for avoiding the collapse of CTDB data recovery, including:
当CTDB主节点执行数据恢复任务时,获取目标任务ID所对应的目标恢复任务的当前状态;When the CTDB master node executes the data recovery task, obtain the current state of the target recovery task corresponding to the target task ID;
当当前状态异常时,在任务列表中查找目标任务ID对应的映射链表;其中,映射链表中包括用于执行目标恢复任务的数据恢复函数以及用于缓存恢复数据而预先申请的内存空间地址,且数据恢复函数与内存空间地址存在映射关系;When the current state is abnormal, look up the mapping linked list corresponding to the target task ID in the task list; wherein, the mapping linked list includes a data recovery function for executing the target recovery task and a pre-applied memory space address for caching and restoring data, and There is a mapping relationship between the data recovery function and the memory space address;
将映射链表移除出任务列表,以避免对内存空间地址进行访问而造成CTDB主节点崩溃。Remove the mapping linked list from the task list to avoid accessing the memory space address and causing the CTDB master node to crash.
优选的,当当前状态异常时,该方法进一步包括:Preferably, when the current state is abnormal, the method further includes:
将目标恢复任务的相关信息记录至表征未完成任务的任务日志;其中,相关信息中至少包括内存空间地址所对应的内存空间容量以及数据恢复函数。Record the relevant information of the target recovery task to the task log representing the unfinished task; wherein, the relevant information at least includes the memory space capacity corresponding to the memory space address and the data recovery function.
优选的,在将目标恢复任务的相关信息记录至表征未完成任务的任务日志后,该方法进一步包括:Preferably, after recording the relevant information of the target recovery task to the task log representing unfinished tasks, the method further includes:
依照内存空间容量在CTDB主节点中申请新内存空间地址,并建立新内存空间地址与数据恢复函数之间的映射关系,生成新映射链表;Apply for a new memory space address in the CTDB master node according to the memory space capacity, and establish a mapping relationship between the new memory space address and the data recovery function, and generate a new mapping list;
将新映射链表与新目标任务ID对应记录至任务列表,以用于再次执行目标恢复任务。The new mapping linked list and the new target task ID are correspondingly recorded in the task list, so as to execute the target recovery task again.
优选的,获取目标任务ID所对应的目标恢复任务的当前状态具体为:Preferably, the current state of the target recovery task corresponding to the target task ID is obtained as follows:
以随机的方式获取目标任务ID所对应的当前状态。Obtain the current state corresponding to the target task ID in a random manner.
优选的,目标任务ID具体为十六进制形式的随机数。Preferably, the target task ID is specifically a random number in hexadecimal form.
优选的,CTDB主节点具体为运行有Linux操作系统的服务器。Preferably, the CTDB master node is specifically a server running a Linux operating system.
此外,本发明还提供一种避免CTDB数据恢复时崩溃的装置,包括:In addition, the present invention also provides a device for avoiding the collapse of CTDB data recovery, including:
状态获取模块,用于当CTDB主节点执行数据恢复任务时,获取目标任务ID所对应的目标恢复任务的当前状态;A state acquisition module is used to obtain the current state of the target recovery task corresponding to the target task ID when the CTDB master node executes the data recovery task;
链表查找模块,用于当当前状态异常时,在任务列表中查找目标任务ID对应的映射链表;其中,映射链表中包括用于执行目标恢复任务的数据恢复函数以及用于缓存恢复数据而预先申请的内存空间地址,且数据恢复函数与内存空间地址存在映射关系;The linked list search module is used to search the mapping linked list corresponding to the target task ID in the task list when the current state is abnormal; wherein, the mapped linked list includes a data recovery function for executing the target recovery task and a pre-applied for cache recovery data memory space address, and there is a mapping relationship between the data recovery function and the memory space address;
链表移除模块,用于将映射链表移除出任务列表,以避免对内存空间地址进行访问而造成CTDB主节点崩溃。The linked list removal module is used to remove the mapping linked list from the task list, so as to avoid the crash of the CTDB master node caused by accessing the memory space address.
优选的,该装置进一步包括:Preferably, the device further comprises:
日志记录模块,用于将目标恢复任务的相关信息记录至表征未完成任务的任务日志;其中,相关信息中至少包括内存空间地址所对应的内存空间容量以及数据恢复函数。The log recording module is used to record the relevant information of the target recovery task to the task log representing the unfinished task; wherein, the relevant information at least includes the memory space capacity corresponding to the memory space address and the data recovery function.
此外,本发明还提供一种避免CTDB数据恢复时崩溃的装置,包括:In addition, the present invention also provides a device for avoiding the collapse of CTDB data recovery, including:
存储器,用于存储计算机程序;memory for storing computer programs;
处理器,用于执行计算机程序时实现如上述的避免CTDB数据恢复时崩溃的方法的步骤。The processor is used for implementing the steps of the above-mentioned method for avoiding the crash during CTDB data recovery when executing the computer program.
此外,本发明还提供一种计算机可读存储介质,计算机可读存储介质上存储有计算机程序,计算机程序被处理器执行时实现如上述的避免CTDB数据恢复时崩溃的方法的步骤。In addition, the present invention also provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the method for avoiding the above-mentioned crash during CTDB data recovery are implemented.
本发明所提供的避免CTDB数据恢复时崩溃的方法,当CTDB主节点所进行的数据恢复出现异常时,根据异常任务的任务ID在任务列表中查找对应映射链表,并且将映射链表从任务列表中移除。由于映射链表中包含有预先申请的内存空间地址,因此即使出现系统因数据恢复出现异常而将内存空间地址释放的情况,也能够确保系统尝试再次执行该异常任务或进行该异常任务的相关监控时,无法在任务列表中获悉内从空间地址的情况,以此避免系统由于无法找到该内存空间而产生core文件,进而避免了CTDB的崩溃,保证了CTDB进行数据恢复时的可靠性。此外,本发明还提供一种避免CTDB数据恢复时崩溃的装置及介质,有益效果同上所述。In the method for avoiding the collapse of CTDB data recovery provided by the present invention, when the data recovery performed by the CTDB master node is abnormal, the corresponding mapping linked list is searched in the task list according to the task ID of the abnormal task, and the mapping linked list is removed from the task list remove. Since the mapping linked list contains the pre-applied memory space address, even if the system releases the memory space address due to an abnormal data recovery, it can ensure that when the system tries to execute the abnormal task again or perform related monitoring of the abnormal task , it is impossible to know the internal slave space address in the task list, so as to prevent the system from generating the core file due to the inability to find the memory space, thereby avoiding the collapse of CTDB, and ensuring the reliability of CTDB for data recovery. In addition, the present invention also provides a device and medium for avoiding the collapse of the CTDB data during restoration, and the beneficial effect is the same as that described above.
附图说明Description of drawings
为了更清楚地说明本发明实施例,下面将对实施例中所需要使用的附图做简单的介绍,显而易见地,下面描述中的附图仅仅是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to illustrate the embodiments of the present invention more clearly, the accompanying drawings used in the embodiments will be briefly introduced below. Obviously, the accompanying drawings in the following description are only some embodiments of the present invention. As far as people are concerned, other drawings can also be obtained based on these drawings on the premise of not paying creative work.
图1为当前情况下进而数据恢复所参照的任务列表的结构;Fig. 1 is the structure of the task list with reference to then data recovery under the current situation;
图2为本发明实施例提供的一种避免CTDB数据恢复时崩溃的方法的流程图;Fig. 2 is a flow chart of a method for avoiding the collapse of CTDB data recovery provided by an embodiment of the present invention;
图3为本发明实施例提供的一种避免CTDB数据恢复时崩溃的装置的结构图。FIG. 3 is a structural diagram of a device for avoiding a crash during CTDB data recovery provided by an embodiment of the present invention.
具体实施方式Detailed ways
下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本发明一部分实施例,而不是全部实施例。基于本发明中的实施例,本领域普通技术人员在没有做出创造性劳动前提下,所获得的所有其他实施例,都属于本发明保护范围。The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only some of the embodiments of the present invention, not all of them. Based on the embodiments of the present invention, all other embodiments obtained by persons of ordinary skill in the art without making creative efforts belong to the protection scope of the present invention.
本发明的核心是提供一种避免CTDB数据恢复时崩溃的方法,以保证CTDB进行数据恢复时的可靠性。本发明的另一核心是提供一种避免CTDB数据恢复时崩溃的装置及介质。The core of the present invention is to provide a method for avoiding the collapse of CTDB data recovery, so as to ensure the reliability of CTDB data recovery. Another core of the present invention is to provide a device and medium for avoiding the collapse of CTDB data recovery.
为了使本技术领域的人员更好地理解本发明方案,下面结合附图和具体实施方式对本发明作进一步的详细说明。In order to enable those skilled in the art to better understand the solution of the present invention, the present invention will be further described in detail below in conjunction with the accompanying drawings and specific embodiments.
实施例一Embodiment one
图2为本发明实施例提供的一种避免CTDB数据恢复时崩溃的方法的流程图。请参考图2,避免CTDB数据恢复时崩溃的方法的具体步骤包括:FIG. 2 is a flow chart of a method for avoiding a crash during CTDB data recovery provided by an embodiment of the present invention. Please refer to Figure 2, the specific steps of the method to avoid the crash during CTDB data recovery include:
步骤S10:当CTDB主节点执行数据恢复任务时,获取目标任务ID所对应的目标恢复任务的当前状态。Step S10: When the CTDB master node executes the data recovery task, obtain the current state of the target recovery task corresponding to the target task ID.
需要说明的是,CTDB数据节点往往管理有多个TDB数据库,CTDB主节点执行数据恢复任务时,是以TDB数据库为单位进行的,即针对每一个TDB数据库建立对应的数据恢复任务,数据恢复任务用于实现拉取TDB数据库中的数据并重新构建至CTDB节点中,相应的,每一个数据恢复任务都有对应的任务ID。另外,对于CTDB主节点与CTDB数据节点之间的数据交互是本领域所公知的技术内容,在此不做赘述。在本步骤中,通过选定目标任务ID以获悉该目标ID对应的目标恢复任务的当前状态,由于可能存在拉取TDB数据库进行数据恢复时,该TDB数据库尚未被“冻结”,仍有数据IO的情况,导致数据不一致,进而当前状态可能因此存在异常。It should be noted that CTDB data nodes often manage multiple TDB databases. When the CTDB master node performs data recovery tasks, it is performed in units of TDB databases, that is, corresponding data recovery tasks are established for each TDB database. Data recovery tasks It is used to pull the data in the TDB database and rebuild it to the CTDB node. Correspondingly, each data recovery task has a corresponding task ID. In addition, the data interaction between the CTDB master node and the CTDB data node is a well-known technical content in the art, and will not be repeated here. In this step, the current status of the target recovery task corresponding to the target ID is known by selecting the target task ID. Since the TDB database may be pulled for data recovery, the TDB database has not been "frozen", and there is still data IO In this case, the data is inconsistent, and the current state may therefore be abnormal.
步骤S11:当当前状态异常时,在任务列表中查找目标任务ID对应的映射链表。Step S11: When the current state is abnormal, look up the mapping list corresponding to the target task ID in the task list.
其中,映射链表中包括用于执行目标恢复任务的数据恢复函数以及用于缓存恢复数据而预先申请的内存空间地址,且数据恢复函数与内存空间地址存在映射关系。Wherein, the mapping linked list includes a data recovery function for executing the target recovery task and a pre-applied memory space address for caching and restoring data, and there is a mapping relationship between the data recovery function and the memory space address.
任务列表的具体结构请参考图1,任务列表中(srvid_handler_List)包含有一系列的数据恢复任务,每一个数据恢复任务都有对应的任务ID(srvid),并且任务ID与对应的映射链表(srvid_handler*h)存在对应关系,即每个任务ID仅有一个对应的映射链表,在映射链表中对应记录有数据恢复函数(pull_database_handler)与内存空间地址(tevent_req*req),在CTDB节点执行数据恢复任务时,将依照目标任务ID获取目标映射链表,进而调用目标映射链表中记录的恢复函数,并将恢复函数所产生的结果缓存至内存空间地址下的内存块中。Please refer to Figure 1 for the specific structure of the task list. The task list (srvid_handler_List) contains a series of data recovery tasks. Each data recovery task has a corresponding task ID (srvid), and the task ID and the corresponding mapping list (srvid_handler* h) There is a corresponding relationship, that is, there is only one corresponding mapping linked list for each task ID, and the data recovery function (pull_database_handler) and memory space address (tevent_req*req) are correspondingly recorded in the mapping linked list. When the CTDB node executes the data recovery task , the target mapping linked list will be obtained according to the target task ID, and then the recovery function recorded in the target mapping linked list will be called, and the result generated by the recovery function will be cached in the memory block under the memory space address.
步骤S12:将映射链表移除出任务列表,以避免对内存空间地址进行访问而造成CTDB主节点崩溃。Step S12: Remove the mapping linked list from the task list, so as to prevent the CTDB master node from crashing due to access to memory space addresses.
由于在数据恢复任务的执行出现异常时,映射链表中的内存空间地址对应的内存空间将被释放,进而无法根据内存空间地址查找到用于缓存数据的内存块,因此一旦因再次执行此数据恢复任务或对此数据恢复任务进行相关监控而访问内存空间地址时,会造成内存空访问的发生,导致CTDB主节点崩溃。而本步骤采取将映射链表移除出任务列表的方式,避免在任务列表中检索到映射链表,进而防止检索到内存空间地址的情况发生。Since the memory space corresponding to the memory space address in the mapping list will be released when the execution of the data recovery task is abnormal, and the memory block for caching data cannot be found according to the memory space address, once the data recovery task is executed again due to When the task or related monitoring of this data recovery task accesses the address of the memory space, it will cause empty memory access and cause the CTDB master node to crash. In this step, the mapping linked list is removed from the task list, so as to prevent the mapping linked list from being retrieved in the task list, thereby preventing the occurrence of the memory space address being retrieved.
本发明所提供的避免CTDB数据恢复时崩溃的方法,当CTDB主节点所进行的数据恢复出现异常时,根据异常任务的任务ID在任务列表中查找对应映射链表,并且将映射链表从任务列表中移除。由于映射链表中包含有预先申请的内存空间地址,因此即使出现系统因数据恢复出现异常而将内存空间地址释放的情况,也能够确保系统尝试再次执行该异常任务或进行该异常任务的相关监控时,无法在任务列表中获悉内从空间地址的情况,以此避免系统由于无法找到该内存空间而产生core文件,进而避免了CTDB的崩溃,保证了CTDB进行数据恢复时的可靠性。In the method for avoiding the collapse of CTDB data recovery provided by the present invention, when the data recovery performed by the CTDB master node is abnormal, the corresponding mapping linked list is searched in the task list according to the task ID of the abnormal task, and the mapping linked list is removed from the task list remove. Since the mapping linked list contains the pre-applied memory space address, even if the system releases the memory space address due to an abnormal data recovery, it can ensure that when the system tries to execute the abnormal task again or perform related monitoring of the abnormal task , it is impossible to know the internal slave space address in the task list, so as to prevent the system from generating the core file due to the inability to find the memory space, thereby avoiding the collapse of CTDB, and ensuring the reliability of CTDB for data recovery.
实施例二Embodiment two
在上述实施例的基础上,本发明还提供以下一系列优选的实施方式。On the basis of the above embodiments, the present invention also provides the following series of preferred implementation manners.
作为一种优选的实施方式,当当前状态异常时,该方法进一步包括:As a preferred implementation, when the current state is abnormal, the method further includes:
将目标恢复任务的相关信息记录至表征未完成任务的任务日志。Record the relevant information of the target recovery task to the task log representing the unfinished task.
其中,相关信息中至少包括内存空间地址所对应的内存空间容量以及数据恢复函数。Wherein, the relevant information at least includes the memory space capacity corresponding to the memory space address and the data recovery function.
考虑到CTDB主节点执行数据恢复任务的总量往往较大,当有数据恢复任务执行异常时,则可能导致TDB数据库中的数据未被顺利重构至CTDB主节点,这对于CTDB主节点整体的数据恢复来说是不完整的,因此本实施方式采取任务日志的方式记录未完成的目标恢复任务的相关信息,便于技术人员根据任务日志所记录的内容对未完成的目标恢复任务进行相应的处理。由于充足的内存空间容量以及正确的数据恢复函数是确保完成数据恢复的基础,因此在本实施方式中,相关信息中至少包括内存空间地址所对应的内存空间容量以及数据恢复函数,以便于再次对未恢复成功的数据进行恢复。Considering that the total amount of data recovery tasks performed by the CTDB master node is often large, when there is an abnormal execution of the data recovery task, the data in the TDB database may not be successfully reconstructed to the CTDB master node, which affects the overall CTDB master node Data recovery is incomplete, so in this embodiment, the task log is used to record the relevant information of the unfinished target recovery task, which is convenient for technicians to deal with the unfinished target recovery task according to the content recorded in the task log . Since sufficient memory space capacity and correct data recovery function are the basis for ensuring the completion of data recovery, in this embodiment, the relevant information includes at least the memory space capacity corresponding to the memory space address and the data recovery function, so that the Data that has not been successfully restored is restored.
在上述实施方式的基础上,作为一种优选的实施方式,在将目标恢复任务的相关信息记录至表征未完成任务的任务日志后,该方法进一步包括:On the basis of the above implementation, as a preferred implementation, after recording the relevant information of the target recovery task to the task log representing the unfinished task, the method further includes:
依照内存空间容量在CTDB主节点中申请新内存空间地址,并建立新内存空间地址与数据恢复函数之间的映射关系,生成新映射链表;Apply for a new memory space address in the CTDB master node according to the memory space capacity, and establish a mapping relationship between the new memory space address and the data recovery function, and generate a new mapping list;
将新映射链表与新目标任务ID对应记录至任务列表,以用于再次执行目标恢复任务。The new mapping linked list and the new target task ID are correspondingly recorded in the task list, so as to execute the target recovery task again.
可以理解的是,本实施方式是根据任务日志所记载的内存空间容量申请新的内存空间地址,进而将新的内存空间地址与数据恢复函数映射为新的映射链表,并将映射链表与新目标任务ID对应记录至任务列表以实现CTDB主节点根据任务列表中的新目标任务ID再次执行目标恢复任务,以此保证CTDB主节点进行数据恢复的完整性。It can be understood that this embodiment is to apply for a new memory space address according to the memory space capacity recorded in the task log, and then map the new memory space address and data recovery function into a new mapping linked list, and link the mapping linked list with the new target The task ID is correspondingly recorded in the task list to enable the CTDB master node to execute the target recovery task again according to the new target task ID in the task list, so as to ensure the integrity of the data recovery performed by the CTDB master node.
此外,作为一种优选的实施方式,获取目标任务ID所对应的目标恢复任务的当前状态具体为:In addition, as a preferred implementation manner, obtaining the current state of the target recovery task corresponding to the target task ID is specifically:
以随机的方式获取目标任务ID所对应的当前状态。Obtain the current state corresponding to the target task ID in a random manner.
由于在任务列表中,各个数据恢复任务的任务ID均是顺序排列的,为了提高选取的目标恢复任务的随机性,确保能够相对公平的获悉每一个数据恢复任务的当前状态,本实施方式采用随机的方式获取目标任务ID所对应的当前状态,相对提高了获取状态异常的数据恢复任务的效率。Since in the task list, the task IDs of each data recovery task are arranged sequentially, in order to improve the randomness of the selected target recovery task and ensure that the current status of each data recovery task can be learned relatively fairly, this embodiment adopts a random The current state corresponding to the target task ID is obtained in a manner, which relatively improves the efficiency of obtaining data recovery tasks with abnormal states.
此外,作为一种优选的实施方式,目标任务ID具体为十六进制形式的随机数。In addition, as a preferred implementation manner, the target task ID is specifically a random number in hexadecimal form.
由于考虑到在当前情况下CTDB主节点所管理的TDB数据库的数量相对庞大,每一个TDB数据库均对应有一个数据恢复任务,因此数据恢复任务的整体数量也比较庞大,采用随机数作为任务ID可以避免任务ID之间出现重复的情况,并且由于十六进制数的每个数位能够表示的值相对更多,因此通过十六进制数表征任务ID能够相对减少数位对空间的占用。Considering that the number of TDB databases managed by the CTDB master node is relatively large in the current situation, each TDB database corresponds to a data recovery task, so the overall number of data recovery tasks is also relatively large, and random numbers can be used as task IDs. Duplication among task IDs is avoided, and since each digit of a hexadecimal number can represent relatively more values, representing a task ID by a hexadecimal number can relatively reduce the space occupied by digits.
此外,作为一种优选的实施方式,CTDB主节点具体为运行有Linux操作系统的服务器。In addition, as a preferred implementation manner, the CTDB master node is specifically a server running a Linux operating system.
由于考虑到Linux操作系统是开源操作系统,相对节省使用成本并且由于其底层代码可见,因此更加易于维护,相较于Windows系统来说Linux系统的稳定性以及安全性更高,保证了CTDB节点工作的可靠性。Considering that the Linux operating system is an open source operating system, it is relatively cost-effective and easier to maintain because its underlying code is visible. Compared with the Windows system, the stability and security of the Linux system are higher, ensuring the work of CTDB nodes reliability.
实施例三Embodiment three
在上文中对于避免CTDB数据恢复时崩溃的方法的实施例进行了详细的描述,本发明还提供一种与该方法对应的避免CTDB数据恢复时崩溃的装置,由于装置部分的实施例与方法部分的实施例相互对应,因此装置部分的实施例请参见方法部分的实施例的描述,这里暂不赘述。The embodiment of the method for avoiding the collapse of CTDB data recovery has been described in detail above, and the present invention also provides a device corresponding to the method for avoiding the collapse of CTDB data recovery, because the embodiment of the device part and the method part The embodiments correspond to each other, so for the embodiments of the device part, please refer to the description of the embodiments of the method part, and details will not be repeated here.
图3为本发明实施例提供的一种避免CTDB数据恢复时崩溃的装置的结构图。本发明实施例提供的避免CTDB数据恢复时崩溃的装置,包括:FIG. 3 is a structural diagram of a device for avoiding a crash during CTDB data recovery provided by an embodiment of the present invention. The device for avoiding the crash during CTDB data recovery provided by the embodiment of the present invention includes:
状态获取模块10,用于当CTDB主节点执行数据恢复任务时,获取目标任务ID所对应的目标恢复任务的当前状态。The status acquisition module 10 is configured to acquire the current status of the target recovery task corresponding to the target task ID when the CTDB master node executes the data recovery task.
链表查找模块11,用于当当前状态异常时,在任务列表中查找目标任务ID对应的映射链表;其中,映射链表中包括用于执行目标恢复任务的数据恢复函数以及用于缓存恢复数据而预先申请的内存空间地址,且数据恢复函数与内存空间地址存在映射关系。Linked list search module 11, for when the current state is abnormal, search the mapping linked list corresponding to the target task ID in the task list; wherein, the mapping linked list includes a data recovery function for executing the target recovery task and a pre-set The requested memory space address, and there is a mapping relationship between the data recovery function and the memory space address.
链表移除模块12,用于将映射链表移除出任务列表,以避免对内存空间地址进行访问而造成CTDB主节点崩溃。The linked list removal module 12 is configured to remove the mapped linked list from the task list, so as to avoid the crash of the CTDB master node caused by accessing the address of the memory space.
本发明所提供的避免CTDB数据恢复时崩溃的装置,当CTDB主节点所进行的数据恢复出现异常时,根据异常任务的任务ID在任务列表中查找对应映射链表,并且将映射链表从任务列表中移除。由于映射链表中包含有预先申请的内存空间地址,因此即使出现系统因数据恢复出现异常而将内存空间地址释放的情况,也能够确保系统尝试再次执行该异常任务或进行该异常任务的相关监控时,无法在任务列表中获悉内从空间地址的情况,以此避免系统由于无法找到该内存空间而产生core文件,进而避免了CTDB的崩溃,保证了CTDB进行数据恢复时的可靠性。The device provided by the present invention for avoiding the collapse of CTDB data recovery, when the data recovery performed by the CTDB master node is abnormal, searches for the corresponding mapping linked list in the task list according to the task ID of the abnormal task, and removes the mapping linked list from the task list remove. Since the mapping linked list contains the pre-applied memory space address, even if the system releases the memory space address due to an abnormal data recovery, it can ensure that when the system tries to execute the abnormal task again or perform related monitoring of the abnormal task , it is impossible to know the internal slave space address in the task list, so as to prevent the system from generating the core file due to the inability to find the memory space, thereby avoiding the collapse of CTDB, and ensuring the reliability of CTDB for data recovery.
在实施例三的基础上,该装置还包括:On the basis of embodiment three, the device also includes:
日志记录模块,用于将目标恢复任务的相关信息记录至表征未完成任务的任务日志;其中,相关信息中至少包括内存空间地址所对应的内存空间容量以及数据恢复函数。The log recording module is used to record the relevant information of the target recovery task to the task log representing the unfinished task; wherein, the relevant information at least includes the memory space capacity corresponding to the memory space address and the data recovery function.
实施例四Embodiment Four
本发明还提供一种避免CTDB数据恢复时崩溃的装置,包括:The present invention also provides a kind of device that avoids the collapse when CTDB data restores, comprising:
存储器,用于存储计算机程序;memory for storing computer programs;
处理器,用于执行计算机程序时实现如上述避免CTDB数据恢复时崩溃的方法的步骤。The processor is used for implementing the steps of the above-mentioned method for avoiding the crash during CTDB data recovery when executing the computer program.
本发明所提供的避免CTDB数据恢复时崩溃的装置,当CTDB主节点所进行的数据恢复出现异常时,根据异常任务的任务ID在任务列表中查找对应映射链表,并且将映射链表从任务列表中移除。由于映射链表中包含有预先申请的内存空间地址,因此即使出现系统因数据恢复出现异常而将内存空间地址释放的情况,也能够确保系统尝试再次执行该异常任务或进行该异常任务的相关监控时,无法在任务列表中获悉内从空间地址的情况,以此避免系统由于无法找到该内存空间而产生core文件,进而避免了CTDB的崩溃,保证了CTDB进行数据恢复时的可靠性。The device provided by the present invention for avoiding the collapse of CTDB data recovery, when the data recovery performed by the CTDB master node is abnormal, searches for the corresponding mapping linked list in the task list according to the task ID of the abnormal task, and removes the mapping linked list from the task list remove. Since the mapping linked list contains the pre-applied memory space address, even if the system releases the memory space address due to an abnormal data recovery, it can ensure that when the system tries to execute the abnormal task again or perform related monitoring of the abnormal task , it is impossible to know the internal slave space address in the task list, so as to prevent the system from generating the core file due to the inability to find the memory space, thereby avoiding the collapse of CTDB, and ensuring the reliability of CTDB for data recovery.
本发明还提供一种计算机可读存储介质,计算机可读存储介质上存储有计算机程序,计算机程序被处理器执行时实现如上述避免CTDB数据恢复时崩溃的方法的步骤。The present invention also provides a computer-readable storage medium. A computer program is stored on the computer-readable storage medium. When the computer program is executed by a processor, the steps of the above-mentioned method for avoiding the collapse of the CTDB data are realized.
本发明所提供的避免CTDB数据恢复时崩溃的计算机可读存储介质,当CTDB主节点所进行的数据恢复出现异常时,根据异常任务的任务ID在任务列表中查找对应映射链表,并且将映射链表从任务列表中移除。由于映射链表中包含有预先申请的内存空间地址,因此即使出现系统因数据恢复出现异常而将内存空间地址释放的情况,也能够确保系统尝试再次执行该异常任务或进行该异常任务的相关监控时,无法在任务列表中获悉内从空间地址的情况,以此避免系统由于无法找到该内存空间而产生core文件,进而避免了CTDB的崩溃,保证了CTDB进行数据恢复时的可靠性。In the computer-readable storage medium provided by the present invention that avoids the collapse of CTDB data recovery, when the data recovery performed by the CTDB master node is abnormal, the corresponding mapping linked list is searched in the task list according to the task ID of the abnormal task, and the mapping linked list is Remove from task list. Since the mapping linked list contains the pre-applied memory space address, even if the system releases the memory space address due to an abnormal data recovery, it can ensure that when the system tries to execute the abnormal task again or perform related monitoring of the abnormal task , it is impossible to know the internal slave space address in the task list, so as to prevent the system from generating the core file due to the inability to find the memory space, thereby avoiding the collapse of CTDB, and ensuring the reliability of CTDB for data recovery.
以上对本发明所提供的一种避免CTDB数据恢复时崩溃的方法、装置及介质进行了详细介绍。说明书中各个实施例采用递进的方式描述,每个实施例重点说明的都是与其他实施例的不同之处,各个实施例之间相同相似部分互相参见即可。对于实施例公开的装置而言,由于其与实施例公开的方法相对应,所以描述的比较简单,相关之处参见方法部分说明即可。应当指出,对于本技术领域的普通技术人员来说,在不脱离本发明原理的前提下,还可以对本发明进行若干改进和修饰,这些改进和修饰也落入本发明权利要求的保护范围内。The method, device and medium for avoiding the crash of CTDB data provided by the present invention have been introduced above in detail. Each embodiment in the description is described in a progressive manner, each embodiment focuses on the difference from other embodiments, and the same and similar parts of each embodiment can be referred to each other. As for the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and for the related information, please refer to the description of the method part. It should be pointed out that for those skilled in the art, without departing from the principle of the present invention, some improvements and modifications can be made to the present invention, and these improvements and modifications also fall within the protection scope of the claims of the present invention.
还需要说明的是,在本说明书中,诸如第一和第二等之类的关系术语仅仅用来将一个实体或者操作与另一个实体或操作区分开来,而不一定要求或者暗示这些实体或操作之间存在任何这种实际的关系或者顺序。而且,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者设备不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者设备所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括所述要素的过程、方法、物品或者设备中还存在另外的相同要素。It should also be noted that in this specification, relative 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 that these entities or operations There is no such actual relationship or order between the operations. Furthermore, the term "comprises", "comprises" or any other variation thereof is intended to cover a non-exclusive inclusion such that a process, method, article, or apparatus comprising a set of elements includes not only those elements, but also includes elements not expressly listed. other elements of or also include elements inherent in such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of additional identical elements in the process, method, article or apparatus comprising said element.
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201810529591.XACN108776628B (en) | 2018-05-29 | 2018-05-29 | A method, device and medium for avoiding crash during CTDB data recovery |
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201810529591.XACN108776628B (en) | 2018-05-29 | 2018-05-29 | A method, device and medium for avoiding crash during CTDB data recovery |
| Publication Number | Publication Date |
|---|---|
| CN108776628Atrue CN108776628A (en) | 2018-11-09 |
| CN108776628B CN108776628B (en) | 2021-10-15 |
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN201810529591.XAActiveCN108776628B (en) | 2018-05-29 | 2018-05-29 | A method, device and medium for avoiding crash during CTDB data recovery |
| Country | Link |
|---|---|
| CN (1) | CN108776628B (en) |
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN111666067A (en)* | 2020-06-22 | 2020-09-15 | 深圳壹账通智能科技有限公司 | Task new building method and device, computer equipment and storage medium |
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| WO2001047224A9 (en)* | 1999-12-22 | 2002-05-23 | Black River Communications Llc | System for automatically conferencing a caller to one or more members of a group |
| US20090249468A1 (en)* | 2005-01-10 | 2009-10-01 | Nokia Siemens Networks Gmbh & Co. Kg | Method for establishing distributed filters in a packet-oriented network, based on abstract security defaults |
| CN101639839A (en)* | 2008-07-30 | 2010-02-03 | 中兴通讯股份有限公司 | Method for searching multi-archive file based on temporary table |
| CN103092712A (en)* | 2011-11-04 | 2013-05-08 | 阿里巴巴集团控股有限公司 | Method and device for recovering interrupt tasks |
| CN103885855A (en)* | 2012-12-20 | 2014-06-25 | 航天信息股份有限公司 | Data backup and recovery method and data backup and recovery device |
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| WO2001047224A9 (en)* | 1999-12-22 | 2002-05-23 | Black River Communications Llc | System for automatically conferencing a caller to one or more members of a group |
| US20090249468A1 (en)* | 2005-01-10 | 2009-10-01 | Nokia Siemens Networks Gmbh & Co. Kg | Method for establishing distributed filters in a packet-oriented network, based on abstract security defaults |
| CN101639839A (en)* | 2008-07-30 | 2010-02-03 | 中兴通讯股份有限公司 | Method for searching multi-archive file based on temporary table |
| CN103092712A (en)* | 2011-11-04 | 2013-05-08 | 阿里巴巴集团控股有限公司 | Method and device for recovering interrupt tasks |
| CN103885855A (en)* | 2012-12-20 | 2014-06-25 | 航天信息股份有限公司 | Data backup and recovery method and data backup and recovery device |
| Title |
|---|
| MOHIT VERMA等: "CTDB: An Integrated Chickpea Transcriptome Database for Functional and Applied Genomics", 《PLOS ONE》* |
| 文莎等: "一种Samba流量统计系统的设计与实现", 《信息通信》* |
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN111666067A (en)* | 2020-06-22 | 2020-09-15 | 深圳壹账通智能科技有限公司 | Task new building method and device, computer equipment and storage medium |
| Publication number | Publication date |
|---|---|
| CN108776628B (en) | 2021-10-15 |
| Publication | Publication Date | Title |
|---|---|---|
| CN113906406B (en) | Database management system | |
| JP5382227B2 (en) | Storage system | |
| KR101801432B1 (en) | Providing transparent failover in a file system | |
| US9727273B1 (en) | Scalable clusterwide de-duplication | |
| KR100974156B1 (en) | File server reinitialization device, method and computer readable recording medium | |
| BR112020019153A2 (en) | SYSTEM AND METHOD FOR PROCESSING THE PROCESS STATE | |
| CN109325016B (en) | Data migration method, device, medium and electronic equipment | |
| US11221785B2 (en) | Managing replication state for deleted objects | |
| CN103559231B (en) | A kind of file system quota management method, apparatus and system | |
| US20200134043A1 (en) | Duplicate Request Checking for File System Interfaces | |
| US9411533B2 (en) | Snapshots and versioning of transactional storage class memory | |
| US11061889B2 (en) | Systems and methods of managing manifest refresh in a database | |
| JP6445049B2 (en) | Log management method and computer system | |
| CN106980699A (en) | A kind of data processing platform (DPP) and system | |
| CN107122442B (en) | Distributed database and access method thereof | |
| CN108182278A (en) | A kind of FRU information maintenance methods and relevant apparatus | |
| CN108776628A (en) | A kind of method, apparatus collapsed when CTDB data being avoided to restore and medium | |
| CN107832455A (en) | A kind of data capture method of storage object, system, equipment and storage medium | |
| JP6260088B2 (en) | Virtual file access system, virtual file access method, and virtual file access program | |
| CN110263060A (en) | A kind of ERP electronic accessories management method and computer equipment | |
| US12253997B2 (en) | Data objects in a distributed file system | |
| CN114817192A (en) | Log processing method, device, device and storage medium | |
| CN109992220A (en) | A lock release method, device, equipment and medium | |
| CN112269677A (en) | Rollback operation device, method, equipment and medium under heterogeneous cloud platform | |
| CN111666267A (en) | Data cleaning method and device and terminal equipment |
| Date | Code | Title | Description |
|---|---|---|---|
| PB01 | Publication | ||
| PB01 | Publication | ||
| SE01 | Entry into force of request for substantive examination | ||
| SE01 | Entry into force of request for substantive examination | ||
| GR01 | Patent grant | ||
| GR01 | Patent grant |