Data processing method and device
By reading and loading hot data block information when the database is abnormal, and using hot data linked lists to determine hot data blocks, the problem of prolonged database abnormal recovery time is solved, and user experience and memory space utilization are improved.
Patent Information
- Application Number
- CN202410724301.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-05
- Publication Date
- 2024-09-13
- Estimated Expiration
- 2044-06-05
AI Technical Summary
When the database is abnormal, the data in the memory space is lost and the recovery time is extended. The recovery time of the existing snapshot technology is long, which affects the user experience.
By determining the hot data information table associated with the abnormal database, read and load the hot data block information into the memory space, and use the hot data linked list to quickly determine the hot data blocks to achieve data preheating and shorten the abnormal recovery time.
It effectively shortens the database exception recovery time, improves user experience, makes full use of memory space, and realizes data preheating in the data block dimension.
Smart Images

Figure CN118296015B
Abstract
Description
Technical Field
[0001] The embodiments of the present specification relate to the field of computer technology, and in particular, to a data processing method and device. Background Art
[0002] Database systems usually use a management method of memory plus disk persistence. When an exception occurs in the database, the data stored in the memory space corresponding to the database before the exception occurs will be lost, and after the database exception is recovered, the data will not be automatically loaded into the memory space. Therefore, the database exception recovery time includes the loading time of the original data in the memory space. This will extend the database exception recovery time and users will not be able to use the database services normally.
[0003] In the prior art, snapshot technology is usually used to deal with database anomalies. However, snapshot technology realizes database anomaly recovery by determining the data state before the database anomaly occurs. Since the amount of data to be recovered is large, it generally takes a long time to recover the database anomaly. Therefore, a more effective data processing method is urgently needed to solve the above problem. Summary of the invention
[0004] In view of this, an embodiment of this specification provides a data processing method. One or more embodiments of this specification also relate to a data processing device, a computing device, a computer-readable storage medium and a computer program product to solve the technical defects existing in the prior art.
[0005] According to a first aspect of an embodiment of this specification, a data processing method is provided, including:
[0006] Determine a hot data information table associated with the abnormal database, wherein the hot data information table records hot data block information, the hot data block information includes hot data storage information, and hot data operation information recorded by a hot data linked table of the abnormal database, and the data operation heat associated with the hot data block information is greater than a heat threshold;
[0007] Calling a data acquisition function, and reading target hot data block information in the hot data information table by executing the data acquisition function;
[0008] The target hot data block is read from the abnormal database based on the target hot data block information and loaded into the memory space.
[0009] Optionally, before determining the hot data information table associated with the abnormal database, the method further includes:
[0010] Determine the hot data linked list associated with the abnormal database;
[0011] The hot data operation information recorded in the hot data linked list is acquired according to an information acquisition cycle, and the hot data operation information is stored in the hot data information table.
[0012] Optionally, the acquiring the hot data operation information recorded in the hot data linked list according to the information acquisition cycle includes:
[0013] Acquire multiple pieces of initial hot data operation information recorded in the hot data linked list according to an information acquisition cycle;
[0014] Determine initial data operation heats corresponding to the multiple pieces of initial hot data operation information;
[0015] The initial hot data operation information whose initial data operation heat is greater than a heat threshold is selected from the multiple pieces of initial hot data operation information as the hot data operation information.
[0016] Optionally, the reading a target hot data block from the abnormal database based on the target hot data block information includes:
[0017] Determine the target hot data storage information and the target hot data operation information included in the target hot data block information;
[0018] A target data block table is determined in the abnormal database based on the target hot data storage information, and a target hot data block is read from the target data block table based on the target hot data operation information.
[0019] Optionally, determining a target data block table in the abnormal database based on the target hot data storage information, and reading a target hot data block in the target data block table based on the target hot data operation information includes:
[0020] Determine target partition table information in the partition table information contained in the target hot data storage information based on index information contained in the target hot data storage information, and determine a target data block table in the abnormal database based on the target partition table information;
[0021] The target hot data block is read from the target data block table based on the data operation heat information and the hot data address information included in the target hot data operation information.
[0022] Optionally, loading the target hot data block into a memory space includes:
[0023] Determine the storage space size of the memory space and the operation heat of the candidate data corresponding to the target hot data block;
[0024] According to the storage space size and the operation heat of the candidate data corresponding to the target hot data block, a hot data block to be loaded is determined in the target hot data block, and the hot data block to be loaded is loaded into the memory space.
[0025] Optionally, before determining the hot data information table associated with the abnormal database, the method further includes:
[0026] Detect the database status of the target database;
[0027] In the case where the database state is an abnormal state, determining that the target database is an abnormal database, and executing the step of determining a hot data information table associated with the abnormal database;
[0028] After the target hot data block is read from the abnormal database based on the target hot data block information and loaded into the memory space, the method further includes:
[0029] The database state of the target database is updated to a non-abnormal state, and a data operation task associated with the target database is performed.
[0030] Optionally, the execution of the data operation task includes:
[0031] Determining a data operation request associated with the target database;
[0032] Parsing the data operation request to obtain a target data identifier;
[0033] Target data is determined in the memory space based on the target data identifier, and the target data is operated.
[0034] According to a second aspect of an embodiment of this specification, there is provided a data processing device, including:
[0035] A determination module is configured to determine a hot data information table associated with an abnormal database, wherein the hot data information table records hot data block information, the hot data block information includes hot data storage information, and hot data operation information recorded by a hot data linked table of the abnormal database, and the data operation heat associated with the hot data block information is greater than a heat threshold;
[0036] A calling module is configured to call a data acquisition function and read target hot data block information in the hot data information table by executing the data acquisition function;
[0037] The loading module is configured to read the target hot data block from the abnormal database based on the target hot data block information and load the target hot data block into the memory space.
[0038] According to a third aspect of an embodiment of this specification, a computing device is provided, including:
[0039] Memory and processor;
[0040] The memory is used to store computer executable instructions, and the processor is used to execute the computer executable instructions. When the computer executable instructions are executed by the processor, the steps of the above data processing method are implemented.
[0041] According to a fourth aspect of the embodiments of this specification, a computer-readable storage medium is provided, which stores computer-executable instructions, and when the instructions are executed by a processor, the steps of the above-mentioned data processing method are implemented.
[0042] According to a fifth aspect of the embodiments of this specification, a computer program product is provided, including a computer program or instructions, which implement the steps of the above-mentioned data processing method when executed by a processor.
[0043] A data processing method provided by an embodiment of the present specification determines a hot data information table associated with the abnormal database when determining an abnormal database and performing abnormal recovery on the abnormal database. The hot data information table records hot data block information, and the hot data block information includes hot data storage information and hot data operation information recorded by a hot data linked list of the abnormal database, and the data operation heat associated with the hot data block information is greater than a heat threshold. Call a data acquisition function, and read the target hot data block information in the hot data information table by executing the data acquisition function. Based on the target hot data block information, read the target hot data block in the abnormal database and load it into the memory space, so as to preheat the data of the abnormally recovered database in the data block dimension and make full use of the memory space. Determine the target hot data block in the abnormal database based on the hot data block information recorded in the hot data linked list, and use the hot data linked list to quickly determine the target hot data block as hot data. Directly load the target hot data block into the memory space, thereby shortening the abnormal recovery time of the abnormal database and improving the user experience. BRIEF DESCRIPTION OF THE DRAWINGS
[0044] Figure 1 is a schematic diagram of a data processing method provided by an embodiment of this specification;
[0045] Figure 2 is a flow chart of a data processing method provided by an embodiment of this specification;
[0046] Figure 3 It is a schematic diagram of a hot data link of a data processing method provided by an embodiment of this specification;
[0047] Figure 4 is a processing flow chart of a data processing method provided by an embodiment of this specification;
[0048] Figure 5 is a structural schematic diagram of a data processing device provided by an embodiment of this specification;
[0049] Figure 6 It is a structural block diagram of a computing device provided by an embodiment of this specification. DETAILED DESCRIPTION
[0050] Many specific details are described in the following description to facilitate a full understanding of this specification. However, this specification can be implemented in many other ways than those described herein, and those skilled in the art can make similar generalizations without violating the connotation of this specification, so this specification is not limited to the specific implementation disclosed below.
[0051] The terms used in one or more embodiments of this specification are only for the purpose of describing specific embodiments, and are not intended to limit one or more embodiments of this specification. The singular forms of "a", "said" and "the" used in one or more embodiments of this specification and the appended claims are also intended to include plural forms, unless the context clearly indicates other meanings. It should also be understood that the term "and / or" used in one or more embodiments of this specification refers to and includes any or all possible combinations of one or more associated listed items.
[0052] It should be understood that although the terms first, second, etc. may be used to describe various information in one or more embodiments of this specification, this information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other. For example, without departing from the scope of one or more embodiments of this specification, the first may also be referred to as the second, and similarly, the second may also be referred to as the first. Depending on the context, the word "if" as used herein may be interpreted as "at the time of" or "when" or "in response to determining".
[0053] In addition, it should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in one or more embodiments of this specification are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with the relevant laws, regulations and standards of the relevant countries and regions, and provide corresponding operation entrances for users to choose to authorize or refuse.
[0054] First, the terms involved in one or more embodiments of this specification are explained.
[0055] RTO (Recovery Time Objective): Recovery time indicator, the time required for fault recovery. After a fault occurs, the time period from when the IT system stops service to when the IT service system is restored is the RTO.
[0056] LRU linked list (Least Recently Used): A data structure used to implement the LRU cache eviction strategy. This strategy assumes that the least recently used data may also be the least used in the future, so when resources are tight, these data will be eliminated first. LRU linked lists are widely used in operating system memory management, database cache systems, and general software cache design to efficiently manage limited cache space.
[0057] See also Figure 1 , Figure 1 A schematic diagram of a data processing method provided according to an embodiment of this specification is shown, such as Figure 1 As shown, in the case of a database failure, the database is determined as an abnormal database. Database abnormality may be caused by hardware failure, network problems, configuration errors, transaction log problems, etc. A hot data information table associated with the abnormal database is determined, wherein the hot data information table records hot data block information, the hot data block information includes hot data storage information, and hot data operation information recorded by the hot data linked list of the abnormal database, and the data operation heat associated with the hot data block information is greater than the heat threshold.
[0058] In actual applications, the hot data information table is also called a system table, which regularly records the hot object information in the database memory data cache area. The information in the system table can be determined based on the data dictionary provided by the database. After determining the hot data information table, call the data acquisition function, and read the target hot data block information in the hot data information table by executing the data acquisition function. Read the target hot data block in the abnormal database based on the target hot data block information and load it into the memory space. Used to implement data preheating for abnormal database recovery. Data preheating can occur after the database system recovery of the abnormal database is completed. The sum of the database system recovery time and the data preheating time is the abnormal recovery time.
[0059] Based on the target hot data block information, the target hot data block is read from the abnormal database and loaded into the memory space, so as to preheat the data of the abnormally recovered database in the data block dimension and make full use of the memory space. Based on the hot data block information recorded in the hot data linked list, the target hot data block is determined in the abnormal database, so as to use the hot data linked list to quickly determine the target hot data block as the hot data. The target hot data block is directly loaded into the memory space, thereby shortening the abnormal recovery time of the abnormal database and improving the user experience.
[0060] In this specification, a data processing method is provided. This specification also relates to a data processing device, a computing device, a computer-readable storage medium and a computer program product, which are described in detail one by one in the following embodiments.
[0061] See also Figure 2 , Figure 2 A flow chart of a data processing method provided according to an embodiment of the present specification is shown, which specifically includes the following steps.
[0062] Step 202: Determine a hot data information table associated with the abnormal database, wherein the hot data information table records hot data block information, the hot data block information includes hot data storage information, and hot data operation information recorded in a hot data linked list of the abnormal database, and the data operation heat associated with the hot data block information is greater than a heat threshold.
[0063] Specifically, an abnormal database refers to a database that has abnormal conditions during operation. The abnormality of the database may be caused by hardware failure, network problems, configuration errors, transaction log problems, and other reasons. The hot data information table refers to the system table maintained by the abnormal database during operation. The system table records the hot object information in the database memory data buffer; the information in the hot data information table may come from the data dictionary of the abnormal database. The hot data block information is the hot object information recorded in the data buffer of the abnormal database; the hot data storage information refers to the table, index, partition table and other information of the abnormal database; the hot data linked list of the abnormal database is the LRU linked list of the abnormal database; the hot data linked list contains multiple data page headers, and the structure of the data page header defines the actual memory address of the data block in the data buffer. The data page header records the hash linked list data block address, the number of times the data block is accessed, and the checkpoint queue. The cold end of the LRU linked list corresponds to the data block with fewer accesses, and the hot end of the LRU linked list corresponds to the data block with more accesses. The hot data operation information is the access count information and the memory address of the data block recorded in the hot data linked list. The data operation heat corresponds to the number of times the data block is accessed. The more times the data block is accessed, the higher the data operation heat. The heat threshold is a judgment condition for determining the heat level of the hot data block.
[0064] Based on this, when an exception occurs in the database, the database is determined to be an abnormal database. It is necessary to perform database system recovery on the abnormal database, as well as data recovery in the hot data pages of the database. Data recovery is data preheating. In the process of data preheating, the hot data information table associated with the abnormal database can be determined first. The hot data information table records hot data block information. The hot data block information includes hot data storage information and hot data operation information recorded in the hot data linked list of the abnormal database, and the data operation heat associated with the hot data block information is greater than the heat threshold. Based on the hot data information table, the data stored in the hot data page of the abnormal database before the exception occurs can be determined. Data preheating can be implemented in the data block dimension, rather than the object dimension, so that the memory space corresponding to the abnormal database can be fully utilized.
[0065] In practical applications, the LRU linked list structure of the exception database is as follows: Figure 3 As shown. The LRU linked list corresponds to the hot end of the LRU linked list and the cold end of the LRU linked list. The LRU linked list defines multiple data page header structures. The hash linked list where the data page header is located is implemented by storing a pointer to the previous data page header structure and a pointer to the next data page header structure in the data page header structure. The data page header structure defines the actual memory address of the data block in the data buffer, that is, the data block address. It also records the number of accesses to the data block and the checkpoint queue. The LRU linked list at the hot end of the LRU linked list records the relevant information of the data blocks with more accesses, and the cold end of the LRU linked list records the relevant information of the data blocks with fewer accesses.
[0066] Furthermore, since the hot data linked list records the real-time access status of the data block, the hot data information table needs to be updated based on the changes in the hot data linked list, which is specifically implemented as follows:
[0067] Determine the hot data linked list associated with the abnormal database; obtain the hot data operation information recorded in the hot data linked list according to the information acquisition cycle, and store the hot data operation information in the hot data information table.
[0068] Specifically, the information acquisition cycle is used to periodically acquire the relevant information of the hot data block recorded in the hot data linked list; each information acquisition cycle completes one information acquisition of the hot data linked list; the information acquisition cycle can be set to a time interval of 5 minutes, 10 minutes, etc. according to actual needs. The hot data operation information can be the access count information of the data block and the hot data address information.
[0069] Based on this, determine the hot data linked list associated with the abnormal database and the multiple data page headers contained in the hot data linked list. Obtain the hot data operation information recorded in each data page header in the hot data linked list according to the information acquisition cycle, and store the hot data operation information in the hot data information table. The access count information and hot data address information in the hot data operation information are stored in the hot data information table in the form of information pairs.
[0070] For example, when the hot data linked list contains data page header 1 and data page header 2, the access count and data block address of the data block recorded in data page header 1, as well as the access count and data block address of the data block recorded in data page header 2 are obtained, and the access count and data block address of the data block are stored in the form of information pairs in the hot data information table.
[0071] In summary, by obtaining the hot data operation information recorded in each data page header in the hot data linked list and storing the hot data operation information in the hot data information table, the relevant information of the data blocks with high data operation heat is stored in the hot data information table, so as to facilitate the subsequent data recovery of the abnormal database.
[0072] Furthermore, considering that the hot data linked list records the relevant information of all accessed data blocks under the abnormal database operation state, these data blocks include frequently accessed data blocks and infrequently accessed data blocks. Therefore, the data operation heat can be determined according to the number of accesses, and then the hot data operation information is selected in the hot data linked list according to the data operation heat. The specific implementation is as follows:
[0073] Acquire multiple pieces of initial hot data operation information recorded in the hot data linked list according to an information acquisition cycle; determine the initial data operation heats corresponding to the multiple pieces of initial hot data operation information respectively; and select the initial hot data operation information whose initial data operation heat is greater than a heat threshold from the multiple pieces of initial hot data operation information as the hot data operation information.
[0074] Specifically, the initial hot data operation information refers to the hot data operation information of all data blocks recorded in the hot data linked list; the initial data operation heat corresponds to the number of accesses to the data block.
[0075] Based on this, multiple pieces of initial hot data operation information recorded in the hot data linked list are obtained according to the information acquisition cycle. The initial data operation heat corresponding to each piece of initial hot data operation information is determined according to the number of inquiries in the initial hot data operation information. The heat threshold is determined, and the initial hot data operation information whose initial data operation heat is greater than the heat threshold is selected as the hot data operation information from multiple pieces of initial hot data operation information. The initial hot data operation information is filtered in the dimension of the number of accesses.
[0076] Using the above example, when the hot data linked list contains data page header 1, data page header 2, data page header 3, data page header 4, data page header 5, and data page header 6. The number of accesses to data page header 1 is 11 times, the number of accesses to data page header 2 is 1 time, the number of accesses to data page header 3 is 24 times, the number of accesses to data page header 4 is 15 times, the number of accesses to data page header 5 is 5 times, and the number of accesses to data page header 6 is 3 times. The heat threshold is 10 times. Then obtain the hot data operation information corresponding to data page header 1, data page header 3, and data page header 4 respectively.
[0077] In summary, hot data operation information is selected from multiple pieces of initial hot data operation information according to the heat threshold, so that the initial hot data operation information is filtered in the data operation heat dimension.
[0078] Step 204: calling a data acquisition function, and reading target hot data block information in the hot data information table by executing the data acquisition function.
[0079] Specifically, after determining the hot data information table associated with the abnormal database, the data acquisition function can be called, and the target hot data block information can be read in the hot data information table by executing the data acquisition function, wherein the data acquisition function is used to realize information acquisition in the hot data information table; the target hot data block information can be all the hot data block information recorded in the hot data information table.
[0080] Based on this, after the hot data information table associated with the abnormal database is determined, the data acquisition function can be called, and the hot data information table can be traversed by executing the data acquisition function to read the traversed hot data block information as the target hot data block information.
[0081] In practical applications, the data acquisition function can be a system function, which is executed when the abnormal database is started. The input parameter of the system function is the table name of the hot data information table. It starts traversing from the hot data block information of the first hot data block in the hot data information table until the traversal of the hot data information table is completed to determine the number of hot data blocks and the target hot data block information.
[0082] In addition, when the data acquisition function is called to read information in the hot data information table and no hot data block information is read, it means that when the abnormal database is restarted, there is no hot data block in the memory space, and the startup of the abnormal database is completed without data preheating.
[0083] Step 206: Read the target hot data block in the abnormal database based on the target hot data block information and load it into the memory space.
[0084] Specifically, after calling the data acquisition function and reading the target hot data block information in the hot data information table by executing the data acquisition function, the target hot data block can be read in the exception database based on the target hot data block information and loaded into the memory space, wherein the target hot data block refers to the data block stored in the disk corresponding to the target hot data block information.
[0085] Based on this, after calling the data acquisition function and reading the target hot data block information in the hot data information table by executing the data acquisition function, the target hot data block can be read in the abnormal database based on the target hot data block information and loaded into the memory space.
[0086] In actual applications, when the target hot data block is loaded into the memory space and the data block loading is completed, it means that the data preheating is completed, that is, the abnormal database startup is completed.
[0087] Furthermore, the target hot data block may be stored in different tables. The target data block table can be determined according to the target hot data storage information, and then the target hot data block can be read from the target data block table. The specific implementation is as follows:
[0088] Determine the target hot data storage information and the target hot data operation information included in the target hot data block information; determine the target data block table in the abnormal database based on the target hot data storage information, and read the target hot data block in the target data block table based on the target hot data operation information.
[0089] Based on this, the target data block table is a data block table for storing hot data blocks. The target hot data storage information and the target hot data operation information contained in the target hot data block information are determined, and the target data block table corresponding to the target hot data storage information is selected from multiple data block tables in the abnormal database based on the target hot data storage information, and the target hot data block is read from the target data block table based on the target hot data operation information.
[0090] Furthermore, the target hot data storage information includes index information and partition table information, which is used to assist in reading the target hot data block, and is specifically implemented as follows:
[0091] Based on the index information contained in the target hot data storage information, the target partition table information is determined in the partition table information contained in the target hot data storage information, and based on the target partition table information, the target data block table is determined in the abnormal database; based on the data operation heat information and the hot data address information contained in the target hot data operation information, the target hot data block is read in the target data block table.
[0092] Specifically, the index information indicates the table index of the partition table where the target hot data block is located; the partition table information refers to the table name and other table information of the data block table where the target data block is located. The data operation heat information indicates the number of accesses to the target hot data block, and the hot data address information indicates the data block address of the target hot data block.
[0093] Based on this, the target partition table information of the table where the target data block corresponding to the target hot data storage information is stored is determined in the partition table information contained in the target hot data storage information based on the index information contained in the target hot data storage information, and the target data block table storing the target data block is determined in the abnormal database based on the target partition table information. The target hot data block is read in the target data block table based on the data operation heat information and the hot data address information contained in the target hot data operation information, so as to realize the reading of all hot data blocks corresponding to the target hot data storage information.
[0094] Using the above example, after obtaining the hot data operation information corresponding to data page header 1, data page header 3, and data page header 4, these four pieces of hot data operation information are used as target hot data operation information. The target partition table corresponding to the data block to be read is determined based on the index contained in the target hot data operation information, and then the target data block table where the data block to be read is located is determined in the target partition table based on the partition table information. Then, all data blocks are read in the target data block table based on the data block address.
[0095] To summarize, the target hot data block is read in the target data block table in combination with the index information and partition table information contained in the target hot data storage information, and the data operation heat information and hot data address information contained in the target hot data operation information, thereby avoiding data block reading omissions and achieving accurate reading of the target data block.
[0096] Furthermore, considering that the storage space of the memory space corresponding to the abnormal database is limited, it may not be possible to store all the hot data blocks corresponding to the hot data information table. Therefore, it is necessary to selectively store the hot data blocks according to the storage space size of the memory space. The specific implementation is as follows:
[0097] Determine the storage space size of the memory space and the operation heat of the candidate data corresponding to the target hot data block; determine the hot data block to be loaded in the target hot data block according to the storage space size and the operation heat of the candidate data corresponding to the target hot data block, and load the hot data block to be loaded into the memory space.
[0098] Based on this, determine the storage space size of the memory space and the candidate data operation heats corresponding to the multiple target hot data blocks. Sort the multiple target hot data blocks according to the candidate data operation heats, and determine the storage space required for each target hot data block. Select the hot data blocks to be loaded in the target data blocks in turn and store them in the memory space until the total storage space required for the hot data blocks to be loaded matches the storage space size, thereby determining the hot data blocks to be loaded that can be loaded into the memory space in the target hot data blocks, and loading the hot data blocks to be loaded into the memory space.
[0099] Using the above example, the target hot data block corresponding to data page header 1 is accessed 11 times, and the storage space occupied is 6; the target hot data block corresponding to data page header 3 is accessed 24 times, and the storage space occupied is 3; the target hot data block corresponding to data page header 4 is accessed 15 times, and the storage space occupied is 10. Sort the data page headers by the number of accesses. When the storage space size of the memory space is 15, the target hot data block corresponding to data page header 1 and the target hot data block corresponding to data page header 4 are loaded into the memory space as the hot data blocks to be loaded.
[0100] In summary, according to the storage space size and the operation heat of the candidate data corresponding to the target hot data block, the hot data block to be loaded is determined in the target hot data block, so that the target data block with higher data operation heat is preferentially loaded into the memory space.
[0101] Furthermore, the database status of the abnormal database can be updated according to the recovery status of the abnormal database, which is specifically implemented as follows:
[0102] Detect the database status of the target database; if the database status is an abnormal state, determine that the target database is an abnormal database, and execute the step of determining the hot data information table associated with the abnormal database; after reading the target hot data block in the abnormal database based on the target hot data block information and loading it into the memory space, it also includes: updating the database status of the target database to a non-abnormal state, and executing the data operation task associated with the target database.
[0103] Based on this, the database status of the target database is detected in real time to detect the operating status or service status of the target database. When the database status is abnormal, it means that the target database cannot provide services normally, and the target database is determined to be an abnormal database and is in an unavailable state. Restart the target database, perform abnormal recovery on the database in the system dimension, and determine the hot data information table associated with the abnormal database. Based on the target hot data block information, read the target hot data block in the abnormal database and load it into the memory space to achieve abnormal recovery of the target database in the data dimension. After the abnormal recovery is completed, the database status of the target database is updated to a non-abnormal state, and the data operation tasks associated with the target database are executed.
[0104] In summary, by performing database status detection on the target database, the operating status of the target database can be monitored in real time, so that when an abnormality occurs in the target database, the target database can be restarted in time to achieve abnormal recovery of the abnormal target database.
[0105] Furthermore, when the abnormal database completes the restart to realize abnormal recovery, the data operation request before the abnormal database occurs can be continued to be completed, which is specifically implemented as follows:
[0106] Determine a data operation request associated with the target database; parse the data operation request to obtain a target data identifier; determine target data in the memory space based on the target data identifier, and operate on the target data.
[0107] Specifically, a data operation request refers to a data access request submitted to a target database for accessing the target database; a data operation request can implement operations such as adding, deleting, modifying, and querying data in the target database. The target data identifier is the identifier of the data to be operated, which can be the storage ID of the data.
[0108] Based on this, determine the data operation request of the target database before the abnormality occurs in the target database. Parse the data operation request and obtain the target data identifier. Determine the target data in the memory space based on the target data identifier and perform corresponding operations on the target data. After the target database is recovered from the abnormality, continue to process the data operation request before the abnormality occurs in the target database, thereby ensuring the service continuity of the target database.
[0109] A data processing method provided by an embodiment of the present specification determines a hot data information table associated with the abnormal database when determining an abnormal database and performing abnormal recovery on the abnormal database. The hot data information table records hot data block information, and the hot data block information includes hot data storage information and hot data operation information recorded by a hot data linked list of the abnormal database, and the data operation heat associated with the hot data block information is greater than a heat threshold. Call a data acquisition function, and read the target hot data block information in the hot data information table by executing the data acquisition function. Based on the target hot data block information, read the target hot data block in the abnormal database and load it into the memory space, so as to preheat the data of the abnormally recovered database in the data block dimension and make full use of the memory space. Determine the target hot data block in the abnormal database based on the hot data block information recorded in the hot data linked list, and use the hot data linked list to quickly determine the target hot data block as hot data. Directly load the target hot data block into the memory space, thereby shortening the abnormal recovery time of the abnormal database and improving the user experience.
[0110] The following combination Figure 4 , taking the application of the data processing method provided in this specification in database abnormal recovery as an example, the data processing method is further described. Figure 4 A processing flow chart of a data processing method provided by an embodiment of the present specification is shown, which specifically includes the following steps.
[0111] Step 402: Determine a hot data linked list associated with the abnormal database.
[0112] In the process of providing services, database anomalies will inevitably occur due to network, hardware, configuration and other issues. After a database failure, the abnormal database needs to be restarted.
[0113] In actual applications, database systems usually adopt a memory + disk persistence management method, using the LRU algorithm to keep the most frequently used memory pages in the memory area. However, when the database is abnormal and restarted, the original memory pages will not be automatically loaded into the memory area. Reloading the application to access data will cause the user to perceive the application as slow. Therefore, after the database is restarted abnormally, the hot data pages on the LRU linked list that are lost in the memory area need to be reloaded to reduce the time that users perceive the slowness of the business system. The hot data linked list is the LRU linked list.
[0114] Step 404: Acquire multiple pieces of initial hot data operation information recorded in the hot data linked list according to the information acquisition cycle.
[0115] Step 406: Determine the initial data operation heats corresponding to the multiple pieces of initial hot data operation information.
[0116] Step 408: Selecting initial hot data operation information whose initial data operation heat is greater than a heat threshold from among the multiple pieces of initial hot data operation information as hot data operation information, and storing the hot data operation information in a hot data information table.
[0117] The hot data information table is a system table used to periodically record hot object information in the database memory data buffer.
[0118] In actual applications, when obtaining hot data operation information in the hot data linked list, the hot data block information corresponding to all data page headers in the LRU linked list can be obtained, or an access count threshold can be set according to the number of times the hot data block is accessed, and the hot data operation information of the data block whose access count is greater than the access count threshold is selected.
[0119] Step 410: calling a data acquisition function, and reading target hot data block information in the hot data information table by executing the data acquisition function.
[0120] The call starts the self-executing function to traverse the hot data information table and obtain the hotspot object, that is, the target hot data block information.
[0121] Step 412: Read the target hot data block based on the target hot data block information.
[0122] The target hot data block information is used as an input parameter of a database reading function to read the target hot data block corresponding to the target hot data block information.
[0123] Step 414: Determine the storage space size of the memory space and the data operation heat of the target hot data block.
[0124] Step 416: According to the storage space size and the data operation heat, determine the hot data block to be loaded in the target hot data block, and load the hot data block to be loaded into the memory space.
[0125] The read target hot data blocks are stored in the memory space. When storing hot data blocks, the storage space size of the memory space is considered, and the target hot data blocks with more access times are stored in the memory space first until the memory space is full.
[0126] In summary, the hot data blocks are obtained by using the LRU linked list provided by the database, and then the hot data blocks are quickly loaded into the memory through system calls, thereby reducing the time that the application perceives slowness after the database is restarted and realizing database preheating. The preheating level is the data block level, not the object level, which can make full use of the memory space. During the abnormal recovery process of the database, not only the RTO of the database system is reduced, but also the hot data storage status of the memory space before the database abnormality is accurately restored.
[0127] A data processing method provided by an embodiment of the present specification determines a hot data information table associated with the abnormal database when determining an abnormal database and performing abnormal recovery on the abnormal database. The hot data information table records hot data block information, and the hot data block information includes hot data storage information and hot data operation information recorded by a hot data linked list of the abnormal database, and the data operation heat associated with the hot data block information is greater than a heat threshold. Call a data acquisition function, and read the target hot data block information in the hot data information table by executing the data acquisition function. Based on the target hot data block information, read the target hot data block in the abnormal database and load it into the memory space, so as to preheat the data of the abnormally recovered database in the data block dimension and make full use of the memory space. Determine the target hot data block in the abnormal database based on the hot data block information recorded in the hot data linked list, and use the hot data linked list to quickly determine the target hot data block as hot data. Directly load the target hot data block into the memory space, thereby shortening the abnormal recovery time of the abnormal database and improving the user experience.
[0128] Corresponding to the above method embodiment, this specification also provides a data processing device embodiment, Figure 5 FIG. 1 is a schematic diagram showing the structure of a data processing device provided by an embodiment of the present specification. Figure 5 As shown, the device comprises:
[0129] The determination module 502 is configured to determine a hot data information table associated with the abnormal database, wherein the hot data information table records hot data block information, the hot data block information includes hot data storage information, and hot data operation information recorded by a hot data linked table of the abnormal database, and the data operation heat associated with the hot data block information is greater than a heat threshold;
[0130] The calling module 504 is configured to call a data acquisition function and read target hot data block information in the hot data information table by executing the data acquisition function;
[0131] The loading module 506 is configured to read the target hot data block from the abnormal database based on the target hot data block information and load the target hot data block into the memory space.
[0132] In an optional embodiment, the determining module 502 is further configured to:
[0133] Determine the hot data linked list associated with the abnormal database;
[0134] The hot data operation information recorded in the hot data linked list is acquired according to an information acquisition cycle, and the hot data operation information is stored in the hot data information table.
[0135] In an optional embodiment, the determining module 502 is further configured to:
[0136] Acquire multiple pieces of initial hot data operation information recorded in the hot data linked list according to an information acquisition cycle;
[0137] Determine initial data operation heats corresponding to the multiple pieces of initial hot data operation information;
[0138] The initial hot data operation information whose initial data operation heat is greater than a heat threshold is selected from the multiple pieces of initial hot data operation information as the hot data operation information.
[0139] In an optional embodiment, the loading module 506 is further configured to:
[0140] Determine the target hot data storage information and the target hot data operation information included in the target hot data block information;
[0141] A target data block table is determined in the abnormal database based on the target hot data storage information, and a target hot data block is read from the target data block table based on the target hot data operation information.
[0142] In an optional embodiment, the loading module 506 is further configured to:
[0143] Determine target partition table information in the partition table information contained in the target hot data storage information based on index information contained in the target hot data storage information, and determine a target data block table in the abnormal database based on the target partition table information;
[0144] The target hot data block is read from the target data block table based on the data operation heat information and the hot data address information included in the target hot data operation information.
[0145] In an optional embodiment, the loading module 506 is further configured to:
[0146] Determine the storage space size of the memory space and the operation heat of the candidate data corresponding to the target hot data block;
[0147] According to the storage space size and the operation heat of the candidate data corresponding to the target hot data block, a hot data block to be loaded is determined in the target hot data block, and the hot data block to be loaded is loaded into the memory space.
[0148] In an optional embodiment, the loading module 506 is further configured to:
[0149] Detect the database status of the target database;
[0150] In the case where the database state is an abnormal state, determining that the target database is an abnormal database, and executing the step of determining a hot data information table associated with the abnormal database;
[0151] After the target hot data block is read from the abnormal database based on the target hot data block information and loaded into the memory space, the method further includes:
[0152] The database state of the target database is updated to a non-abnormal state, and a data operation task associated with the target database is performed.
[0153] In an optional embodiment, the loading module 506 is further configured to: determine a data operation request associated with the target database;
[0154] Parsing the data operation request to obtain a target data identifier;
[0155] Target data is determined in the memory space based on the target data identifier, and the target data is operated.
[0156] A data processing method provided by an embodiment of the present specification determines a hot data information table associated with the abnormal database when determining an abnormal database and performing abnormal recovery on the abnormal database. The hot data information table records hot data block information, and the hot data block information includes hot data storage information and hot data operation information recorded by a hot data linked list of the abnormal database, and the data operation heat associated with the hot data block information is greater than a heat threshold. Call a data acquisition function, and read the target hot data block information in the hot data information table by executing the data acquisition function. Based on the target hot data block information, read the target hot data block in the abnormal database and load it into the memory space, so as to preheat the data of the abnormally recovered database in the data block dimension and make full use of the memory space. Determine the target hot data block in the abnormal database based on the hot data block information recorded in the hot data linked list, and use the hot data linked list to quickly determine the target hot data block as hot data. Directly load the target hot data block into the memory space, thereby shortening the abnormal recovery time of the abnormal database and improving the user experience.
[0157] The above is a schematic scheme of a data processing device of this embodiment. It should be noted that the technical scheme of the data processing device and the technical scheme of the above data processing method belong to the same concept, and the details of the technical scheme of the data processing device that are not described in detail can all be referred to the description of the technical scheme of the above data processing method.
[0158] Figure 6The block diagram of a computing device 600 according to an embodiment of the present specification is shown. The components of the computing device 600 include but are not limited to a memory 610 and a processor 620. The processor 620 is connected to the memory 610 via a bus 630, and the database 650 is used to store data.
[0159] The computing device 600 also includes an access device 640 that enables the computing device 600 to communicate via one or more networks 660. Examples of these networks include a public switched telephone network (PSTN), a local area network (LAN), a wide area network (WAN), a personal area network (PAN), or a combination of communication networks such as the Internet. The access device 640 may include one or more of any type of network interface (e.g., a network interface card (NIC)) that is wired or wireless, such as an IEEE 802.11 wireless local area network (WLAN) wireless interface, a world-wide interoperability for microwave access (Wi-MAX) interface, an Ethernet interface, a universal serial bus (USB) interface, a cellular network interface, a Bluetooth interface, and a near field communication (NFC).
[0160] In one embodiment of the present specification, the above components of the computing device 600 and Figure 6 Other components not shown in the figure may also be connected to each other, for example, via a bus. It should be understood that Figure 6 The computing device structure block diagram shown is only for the purpose of illustration, and is not intended to limit the scope of this specification. Those skilled in the art can add or replace other components as needed.
[0161] The computing device 600 may be any type of stationary or mobile computing device, including a mobile computer or mobile computing device (e.g., a tablet computer, a personal digital assistant, a laptop computer, a notebook computer, a netbook, etc.), a mobile phone (e.g., a smart phone), a wearable computing device (e.g., a smart watch, smart glasses, etc.), or other types of mobile devices, or a stationary computing device such as a desktop computer or a personal computer (PC). The computing device 600 may also be a mobile or stationary server.
[0162] The processor 620 is used to execute the following computer executable instructions, which implement the steps of the above data processing method when executed by the processor.
[0163] The above is a schematic scheme of a computing device of this embodiment. It should be noted that the technical scheme of the computing device and the technical scheme of the above data processing method belong to the same concept, and the details not described in detail in the technical scheme of the computing device can be referred to the description of the technical scheme of the above data processing method.
[0164] An embodiment of the present specification further provides a computer-readable storage medium storing computer-executable instructions, which can implement the steps of the above-mentioned data processing method when executed by a processor.
[0165] The above is a schematic scheme of a computer-readable storage medium of this embodiment. It should be noted that the technical scheme of the storage medium and the technical scheme of the above data processing method belong to the same concept, and the details not described in detail in the technical scheme of the storage medium can be referred to the description of the technical scheme of the above data processing method.
[0166] An embodiment of the present specification also provides a computer program product, including a computer program or instructions, which implement the steps of the above data processing method when executed by a processor.
[0167] The above is a schematic scheme of a computer program product of this embodiment. It should be noted that the technical scheme of the computer program product and the technical scheme of the above data processing method belong to the same concept, and the details not described in detail in the technical scheme of the computer program product can be referred to the description of the technical scheme of the above data processing method.
[0168] The above is a description of a specific embodiment of the specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0169] The computer instructions include computer program codes, which may be in source code form, object code form, executable files or some intermediate forms, etc. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, USB flash drive, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electric carrier signal, telecommunication signal and software distribution medium, etc. It should be noted that the content contained in the computer-readable medium may be appropriately increased or decreased according to the requirements of patent practice. For example, in some regions, according to patent practice, computer-readable media do not include electric carrier signals and telecommunication signals.
[0170] It should be noted that, for the above-mentioned method embodiments, for the sake of simplicity of description, they are all expressed as a series of action combinations, but those skilled in the art should be aware that the embodiments of this specification are not limited by the order of the actions described, because according to the embodiments of this specification, some steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the embodiments of this specification.
[0171] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0172] The preferred embodiments of this specification disclosed above are only used to help explain this specification. The optional embodiments do not describe all the details in detail, nor do they limit the invention to the specific implementation methods described. Obviously, many modifications and changes can be made according to the content of the embodiments of this specification. This specification selects and specifically describes these embodiments in order to better explain the principles and practical applications of the embodiments of this specification, so that technicians in the relevant technical field can understand and use this specification well.
Claims
1. A data processing method, It is characterized in that include: Determine a hot data information table associated with the abnormal database, wherein the hot data information table records hot data block information, the hot data block information includes hot data storage information, and hot data operation information recorded by a hot data linked list of the abnormal database, and the data operation heat associated with the hot data block information is greater than a heat threshold, the hot data linked list includes a cold end and a hot end, respectively recording hot data blocks with different access times, the hot data linked list includes a plurality of data page header structures, the data page header structure stores a pointer to a previous data page header structure and a pointer to a next data page header structure, and the data page header structure defines a memory address of a data block in a data buffer; Calling a data acquisition function, taking the table name of the hot data information table as an input parameter of the data acquisition function, and reading target hot data block information in the hot data information table by executing the data acquisition function, wherein the data acquisition function is executed when the abnormal database is started; Based on the target hot data block information, the target hot data block is read in the abnormal database and loaded into the memory space, so as to preheat the data for the recovery of the abnormal database after the database system of the abnormal database is recovered. The sum of the database system recovery time and the data preheating time is the abnormal recovery time, wherein the completion of data preheating indicates that the startup of the abnormal database is completed.
2. The data processing method according to claim 1, It is characterized in that Before determining the hot data information table associated with the abnormal database, the method further includes: Determine the hot data linked list associated with the abnormal database; The hot data operation information recorded in the hot data linked list is acquired according to an information acquisition cycle, and the hot data operation information is stored in the hot data information table.
3. The data processing method according to claim 2, It is characterized in that The step of acquiring the hot data operation information recorded in the hot data linked list according to the information acquisition cycle includes: Acquire multiple pieces of initial hot data operation information recorded in the hot data linked list according to an information acquisition cycle; Determine initial data operation heats corresponding to the multiple pieces of initial hot data operation information; The initial hot data operation information whose initial data operation heat is greater than a heat threshold is selected from the multiple pieces of initial hot data operation information as the hot data operation information.
4. The data processing method according to claim 1, It is characterized in that The reading the target hot data block in the abnormal database based on the target hot data block information includes: Determine the target hot data storage information and the target hot data operation information included in the target hot data block information; A target data block table is determined in the abnormal database based on the target hot data storage information, and a target hot data block is read from the target data block table based on the target hot data operation information.
5. The data processing method according to claim 4, It is characterized in that The step of determining a target data block table in the abnormal database based on the target hot data storage information, and reading a target hot data block in the target data block table based on the target hot data operation information includes: Determine target partition table information in the partition table information contained in the target hot data storage information based on index information contained in the target hot data storage information, and determine a target data block table in the abnormal database based on the target partition table information; The target hot data block is read from the target data block table based on the data operation heat information and the hot data address information included in the target hot data operation information.
6. The data processing method according to claim 1, It is characterized in that Loading the target hot data block into the memory space includes: Determine the storage space size of the memory space and the operation heat of the candidate data corresponding to the target hot data block; According to the storage space size and the operation heat of the candidate data corresponding to the target hot data block, a hot data block to be loaded is determined in the target hot data block, and the hot data block to be loaded is loaded into the memory space.
7. The data processing method according to claim 1, It is characterized in that Before determining the hot data information table associated with the abnormal database, the method further includes: Detect the database status of the target database; In the case where the database state is an abnormal state, determining that the target database is an abnormal database, and executing the step of determining a hot data information table associated with the abnormal database; After the target hot data block is read from the abnormal database based on the target hot data block information and loaded into the memory space, the method further includes: The database state of the target database is updated to a non-abnormal state, and a data operation task associated with the target database is performed.
8. The data processing method according to claim 7, It is characterized in that The execution of the data operation task includes: Determining a data operation request associated with the target database; Parsing the data operation request to obtain a target data identifier; Target data is determined in the memory space based on the target data identifier, and the target data is operated.
9. A data processing device, It is characterized in that include: A determination module is configured to determine a hot data information table associated with an abnormal database, wherein the hot data information table records hot data block information, the hot data block information includes hot data storage information, and hot data operation information recorded by a hot data linked list of the abnormal database, and the data operation heat associated with the hot data block information is greater than a heat threshold, the hot data linked list includes a cold end and a hot end, respectively recording hot data blocks with different access times, the hot data linked list includes a plurality of data page header structures, the data page header structure stores a pointer to a previous data page header structure and a pointer to a next data page header structure, and the data page header structure defines a memory address of a data block in a data buffer; A calling module is configured to call a data acquisition function, take the table name of the hot data information table as an input parameter of the data acquisition function, and read the target hot data block information in the hot data information table by executing the data acquisition function, wherein the data acquisition function is executed when the abnormal database is started; A loading module is configured to read the target hot data block in the abnormal database based on the target hot data block information and load it into the memory space, and is used to preheat the data for the recovery of the abnormal database after the database system of the abnormal database is recovered. The sum of the database system recovery time and the data preheating time is the abnormal recovery time, wherein the completion of data preheating indicates that the startup of the abnormal database is completed.
10. A computing device, It is characterized in that include: Memory and processor; The memory is used to store computer-executable instructions, and the processor is used to execute the computer-executable instructions. When the computer-executable instructions are executed by the processor, the steps of the data processing method according to any one of claims 1 to 8 are implemented.
11. A computer-readable storage medium, It is characterized in that It stores computer executable instructions, which, when executed by a processor, implement the steps of the data processing method described in any one of claims 1 to 8.
12. A computer program product, It is characterized in that The method comprises a computer program or an instruction, which, when executed by a processor, implements the steps of the data processing method according to any one of claims 1 to 8.
