Data storage method and device, computer equipment and storage system
By caching the updated version of the database page on the application server and storing the corresponding thing logs in the storage server, the problems of large cache space and large bandwidth consumption in the storage server in the prior art are solved, and more efficient data storage is achieved.
Patent Information
- Application Number
- CN202311266328.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-09-27
- Publication Date
- 2025-03-28
AI Technical Summary
When the prior art adopts network-attached storage databases, the storage server caches the database pages to occupy a large amount of storage space, and the bandwidth consumption between the application server and the storage server is large.
By caching the updated page on the application server and storing the logs of the things corresponding to the updated page in the storage server, avoiding the updated page to the storage server, thereby reducing bandwidth consumption and storage space usage.
It effectively reduces bandwidth consumption between the application server and the storage server, saves the storage space of the storage server, and improves the efficiency of data storage.
Smart Images

Figure CN119719049A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computers, and in particular to a data storage method, device, computer equipment and storage system. Background Art
[0002] Currently, Network Attached Storage (NAS) is used to store database data to ensure the reliability and availability of the database. For example, after performing a database operation on a database page, the database page and transaction log are stored in a storage server. However, the storage server caches the database page and needs to occupy a large amount of storage space. In addition, the transmission of the database page between the application server and the storage server also consumes a large amount of bandwidth between the application server and the storage server. Summary of the invention
[0003] The present application provides a data storage method, apparatus, computer equipment and storage system, thereby reducing the storage space required for pages of a storage server cache database and the bandwidth between an application server and a storage server.
[0004] In a first aspect, a data storage method is provided, which is applied to an application server, the application server is connected to a storage server, the application server is used to run a database, and the storage server is used to store database data. The method includes performing database operations on pages of the database, caching the updated pages in the memory of the application server, and storing the transaction log corresponding to the updated pages in the storage server.
[0005] Compared with transmitting the updated page from the application server to the storage server, the storage server stores the updated page, resulting in consumption of bandwidth between the application server and the storage server and storage space of the storage server. The method provided by the present application stores the updated page on the application server and stores the transaction log corresponding to the updated page on the storage server, thereby avoiding transmitting the updated page to the storage server to reduce the bandwidth between the application server and the storage server. In addition, since the storage server does not need to cache the updated page, the storage space cached in the storage server is saved.
[0006] In a possible implementation, caching the updated page in a memory of the application server includes: caching a page identifier and data of the updated page in the memory of the application server, wherein the page identifier is used to indicate the page and the updated page.
[0007] Thus, the application server can determine the updated page as quickly as possible from the memory of the application server based on the page identifier, or search for the updated page as quickly as possible.
[0008] In another possible implementation, storing the transaction log corresponding to the updated page in the storage server includes: storing the page identifier and the transaction log in the storage server, wherein the page identifier is used to indicate the page and the updated page.
[0009] In this way, the storage server generates the updated page according to the transaction log, and establishes the corresponding relationship between the page identifier, the updated page and the transaction log. When the application server fails, the updated page recovery data is obtained from the storage server as soon as possible according to the page identifier.
[0010] In another possible implementation, the method further includes: the application server receives a response message sent by the storage server, and the response message may indicate the updated page indicated by the page identifier corresponding to the stored transaction log. Understandably, the response message indicates that the storage server has generated the updated page indicated by the page identifier based on the transaction log. Then the application server may query the updated page cached by the application server according to the page identifier, and invalidate the updated page indicated by the page identifier.
[0011] Since the storage server has stored the updated page, the updated page stored in the application server is invalidated, and the storage space used for caching the updated page in the application server is released to facilitate the storage of the latest updated page obtained after performing database operations on the database page.
[0012] In another possible implementation, invalidating the updated page stored in the memory of the application server includes: invalidating the updated page stored in the memory of the application server according to the access characteristics of the updated page.
[0013] For example, the feature of determining whether the updated page is frequently accessed. If the access feature of the updated page indicates that the updated page is frequently accessed, the updated page can be called a hot page and the updated page does not need to be invalidated; if the access feature of the updated page indicates that the updated page is not frequently accessed, the updated page can be called a cold page and the updated page can be invalidated.
[0014] This frees up storage space in the application server that is used to cache updated pages.
[0015] In another possible implementation, invalidating the updated page stored in the memory of the application server includes: invalidating the updated page stored in the memory of the application server according to the storage capacity of the memory in the application server.
[0016] Since the storage capacity of the memory is limited, when the storage space of the memory is exhausted, it is impossible to store new updated pages. By failing the storage server to store updated pages, it is ensured that there is enough space in the application server to store new updated pages, which can reduce the memory occupied by the storage server to store updated pages. Frequently accessed pages can also be obtained in time when they need to be scheduled.
[0017] In another possible implementation, the method further includes: acquiring the updated page from the memory of the application server according to the query request.
[0018] In this way, since the updated page is cached in the application server, when the application server needs to perform a database operation on the updated page, the updated page can be obtained as quickly as possible.
[0019] In another possible implementation, the method further includes: when the updated page is not read from the memory of the application server, acquiring the updated page from the storage server.
[0020] In this way, when the application server fails, the updated page can be obtained from the storage server, solving the problem of long page recovery time and ensuring the reliability and availability of the database.
[0021] In a second aspect, a data storage device is provided, including: a communication module for obtaining database operations; a processing module for performing database operations on database pages to obtain updated pages; the processing module is also used to cache the updated pages in the memory of the application server; the processing module is also used to store the transaction log corresponding to the updated page in the storage server.
[0022] In a possible implementation, when the processing module caches the updated page in the memory of the application server, it is specifically configured to cache the page identifier and the updated page in the memory of the application server, where the page identifier is used to indicate the page and the updated page.
[0023] In a possible implementation, the processing module stores the transaction log corresponding to the updated page in the storage server, specifically storing the page identifier and the transaction log in the storage server, the page identifier has a corresponding relationship with the transaction log, and the page identifier is used to indicate the page and the updated page.
[0024] In a possible implementation, the communication module is also used to receive a response message sent by the storage server, the response message is used to indicate the updated page indicated by the page identifier corresponding to the stored transaction log; the processing module is also used to invalidate the updated page stored in the memory of the application server.
[0025] In a possible implementation, the processing module invalidates the updated page stored in the memory of the application server, specifically for invalidating the updated page stored in the memory of the application server according to the access characteristics of the updated page.
[0026] In a possible implementation, the processing module invalidates the updated page stored in the memory of the application server, specifically for invalidating the updated page stored in the memory of the application server according to the storage capacity of the memory of the application server.
[0027] In a possible implementation, the processing module is further configured to obtain the updated page from the memory of the application server according to the query request.
[0028] In a possible implementation, the processing module is further configured to obtain the updated page from the storage server when the updated page is not read from the memory of the application server.
[0029] In a third aspect, a computer device is provided, which includes a memory and multiple processors, the memory being used to store a set of computer instructions; when the processor executes the set of computer instructions, the operating steps of the method described in the first aspect or any possible implementation of the first aspect are performed.
[0030] In a fourth aspect, a storage system is provided, the storage system comprising an application server and a storage server. The application server is used to execute the operation steps of the method described in the first aspect or any possible implementation of the first aspect, and cache the pages of the database; the storage server is used to persistently store the pages of the database and the transaction logs corresponding to the pages of the database.
[0031] The technical effects brought about by any design method in the second to fourth aspects can refer to the technical effects brought about by the first aspect or different possible implementation methods of the first aspect, and will not be repeated here.
[0032] Based on the implementations provided in the above aspects, the present application can be further combined to provide more implementations. BRIEF DESCRIPTION OF THE DRAWINGS
[0033] Figure 1 A schematic diagram of a storage system provided by the prior art;
[0034] Figure 2 A schematic diagram of another storage system provided by the prior art;
[0035] Figure 3 A schematic diagram of another storage system provided by the prior art;
[0036] Figure 4 A schematic diagram of a storage system provided for this application;
[0037] Figure 5 A schematic diagram of a data storage method provided in this application;
[0038] Figure 6 A flowchart of another data storage method provided by this application;
[0039] Figure 7 A flowchart of another data storage method provided by this application;
[0040] Figure 8 A structural schematic diagram of a data storage device provided in this application;
[0041] Fig. 9 A schematic diagram of a computer device provided for this application. DETAILED DESCRIPTION
[0042] To facilitate understanding, the main terms involved in this application are first explained.
[0043] Database: refers to a system that organizes, stores and manages data based on data structures, i.e., an electronic filing cabinet. Databases can include relational databases or non-relational databases. The data stored in a database can include travel records, consumption records, web pages browsed, messages sent, images, music and sounds, etc.
[0044] Network Attached Storage (NAS): is a storage device connected to an application server via a network for centralized data storage. NAS can also be called network storage or storage server. For example, NAS can include a disk array that stores data in a centralized manner. Storing data in NAS can free up storage space associated with application servers, reduce storage costs for application servers, and improve application server performance.
[0045] For example, Figure 1 A schematic diagram of a storage system provided by the prior art. Figure 1 As shown, the storage system 100 includes an application server 110, a cold standby server 120, and a storage server 130. The storage server 130 can be used as a network attached storage for the application server 110 and the cold standby server 120. For example, the application server 110 can perform database operations on the pages of the database according to the database instructions, and generate updated pages and transaction logs. The database instructions include but are not limited to MySQL statements, and the database operations include but are not limited to operations such as writing data, modifying data, and deleting data.
[0046] In some embodiments, the application server 110 stores the updated page and the transaction log in the cold standby server 120 and the storage server 130. The cold standby server 120 then stores the updated page and the transaction log in the storage server 130. It is understandable that two copies of the updated page and the transaction log are stored in the storage server 130, thereby ensuring data reliability, so that when the application server 110 fails, the updated page can be restored by obtaining data from the storage server 130. However, this causes the storage server 130 to redundantly store the updated page and the transaction log, occupying too much storage space in the storage server 130. In addition, the application server 110 transmits the updated page and the transaction log to the storage server 130, which also occupies the bandwidth between the application server 110 and the storage server 130.
[0047] In other embodiments, since the application server 110 periodically stores the updated page in the storage server 130, when the application server 110 fails, if the application server 110 has not stored the updated page in the storage server 130, the storage server 130 can restore the updated page according to the transaction log, so that the application server 110 obtains data from the storage server 130 to restore the updated page. Since the transaction log is read sequentially, the page recovery time is relatively long.
[0048] Optionally, the storage server 130 has functions such as replica storage, erasure coding (EC) / disk array (RAID), replication, active-active, deduplication and compression. EC / RAID can divide files into smaller storage blocks. Active-active means that both the primary and standby storage servers are responsible for the user's business. Deduplication and compression is to delete duplicate data and compress and store the deleted data to reduce data redundancy.
[0049] As another example, Figure 2 A schematic diagram of another storage system provided by the prior art. Figure 2 In the embodiment, the storage system 200 includes an application server 210, a cold standby server 220 and a storage server 230, wherein the storage server 230 further includes a first storage array 231 and a second storage array 232. The storage server 230 can be used as a network attached storage for the application server 210 and the cold standby server 220. Figure 2 and Figure 1 The difference is that Figure 2Data sensing operations and page materialization operations are added. The storage server 230 receives the updated page and the transaction log, performs data sensing operations, that is, identifies the updated page and the transaction log, and stores the updated page and the transaction log in different storage arrays. For example, the updated page and the transaction log are stored in the first storage array 231, and the transaction log is stored in the second storage array 232.
[0050] The storage server 230 also generates updated pages according to the transaction log, and stores the generated updated pages in the second storage array 232. This operation may be referred to as page materialization. For example, the storage server 230 stores the updated pages according to the format of the file system.
[0051] In addition, when the storage server 230 receives the updated page and transaction log for the first time, that is, the storage server 230 identifies the time point (Time_Point, TP) of the first storage array, the updated page and transaction log stored in the first storage array 231 will be copied and stored in the second storage array 232.
[0052] Although the cold standby server 220 does not need to transmit the updated pages and transaction logs to the storage server 130, the storage server 130 still redundantly stores the updated pages and transaction logs, occupying too much storage space in the storage server 130. In addition, the application server 210 transmits the updated pages and transaction logs to the storage server 230, which also occupies the bandwidth between the application server 210 and the storage server 230.
[0053] In some embodiments, when the application server 210 fails, the application server 210 can obtain the updated page from the storage server 230. However, in some embodiments, since the speed of page materialization and page generation cannot be guaranteed, the application server 210 fails to obtain the updated page from the storage server 230, and it may take time to obtain the updated page, so there is still a problem of long page recovery time.
[0054] As another example, Figure 3 A schematic diagram of another storage system provided by the prior art. Figure 3 In the embodiment, the storage system 300 includes an application server 310, a cold standby server 320 and a storage server 330. The storage server 330 can be used as a network attached storage of the application server 310. Figure 3 and Figure 2 The difference is that Figure 3 A page elimination linkage mechanism is added. The storage server 330 performs a data sensing operation, and the storage server 330 stores the identified updated page in a high-availability cache; the storage server 330 generates an updated page according to the identified transaction log.
[0055] In some embodiments, since the storage capacity of the high-availability cache is limited, when the storage space of the high-availability cache is exhausted, it is impossible to store new updated pages. In this case, the updated pages already stored in the high-availability cache are invalidated to ensure that the high-availability cache has enough space to store new updated pages. For example, if the updated pages generated according to the transaction log have been stored in the storage array, the updated pages stored in the high-availability cache can be invalidated, that is, this operation can become a page elimination linkage mechanism. This operation can reduce the double storage of updated pages, but the use of a high-speed cache memory to cache updated pages increases storage costs.
[0056] However, the storage server 130 still redundantly stores the updated pages and transaction logs, occupying too much storage space in the storage server 130. In addition, the application server 310 transmits the updated pages and transaction logs to the storage server 330, occupying the bandwidth between the application server 310 and the storage server 330.
[0057] In order to solve the problem of bandwidth occupation and high-availability cache occupation during storage, the present application provides a data storage method, that is, the application server is connected to the storage server, the application server identifies the transaction log and the updated page, stores the updated page in the memory of the application server, and stores the transaction log corresponding to the updated page in the storage server. In this way, the updated page can be avoided from being transmitted to the storage server to reduce the bandwidth occupied between the application server and the storage server; caching the updated page to the application server also reduces the waste of the high-availability cache of the storage server.
[0058] The data storage method provided in this application can be applied to scenarios where storage and computing are separated, and can also be applied to other types of storage systems.
[0059] The implementation of the data storage method provided by the present application is described in detail below with reference to the accompanying drawings. Figure 4 A schematic diagram of the structure of a storage system provided in this application. Figure 4 As shown, the storage system 400 includes a client 410 , an application server 420 , and a storage server 430 .
[0060] The client 410 accesses the application server 420 through the network 440 . The application server 420 is connected to the storage server 430 through the network 450 .
[0061] In the embodiment of the present application, the application server 420 can run a database. The application server 420 receives a database instruction from the client 410, and can perform database operations on the pages of the database according to the database instruction to generate updated pages and transaction logs.
[0062] In some embodiments, the application server 420 includes a processor 421 and a memory 422. The processor 421 is the control center of the application server 420. The processor 421 may be a central processing unit (CPU), a graphics processing unit (GPU), a data processing unit (DPU), a neural processing unit (NPU), or other computing units with computing capabilities. The processor 421 includes one processor core or multiple processor cores.
[0063] In the embodiment of the present application, the processor 421 is used to identify operations such as transaction logs and updated pages, store the identified updated pages in the memory 422, and store the identified transaction logs in the storage server 430.
[0064] The memory 422 is a cache space of the application server 420, which can read and write data at any time, and serves as a temporary data storage for the operating system or other running programs. It can be a volatile memory pool or a non-volatile memory pool, or can include both volatile and non-volatile memory. Among them, the non-volatile memory can be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. The volatile memory can be a random access memory (RAM), which is used as an external cache. By way of example and not limitation, many forms of RAM are available, such as static RAM (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDRSDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link dynamic random access memory (SLDRAM), and direct rambus RAM (DR RAM).
[0065] In the embodiment of the present application, the memory 422 is mainly used to store updated pages.
[0066] The storage server 430 includes a processor 431 and a storage array 432 .
[0067] The processor 431 is the control center of the storage server 430. The processor 431 may be a computing unit with computing capability such as a CPU, a GPU, a DPU, or a NPU. The processor 431 includes one processor core or multiple processor cores.
[0068] In the embodiment of the present application, the processor 431 mainly generates an updated page based on the transaction log, and stores the updated page in the storage array 432. The storage array 432 is the storage space of the storage server 430, which mainly stores the transaction log and the updated page. The storage array 432 can read and write data at any time, as a temporary data storage for the operating system or other running programs. It can be a volatile memory pool or a non-volatile memory pool, or can include both volatile and non-volatile memory. Among them, the non-volatile memory can be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM) or a flash memory. The volatile memory can be a random access memory (RAM), which is used as an external cache. By way of example and not limitation, many forms of RAM are available, such as static RAM (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDR SDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link dynamic random access memory (SLDRAM), and direct rambus RAM (DR RAM).
[0069] In the embodiment of the present application, the storage array 432 is mainly used to store transaction logs and updated pages.
[0070] Network 440 may be any telecommunications or computer network, including, for example, an intranet, a wide area network (WAN), a local area network (LAN), a personal area network (PAN), or the Internet.
[0071] Network 450 may be any telecommunications or computer network, including, for example, an intranet, a wide area network (WAN), a local area network (LAN), a personal area network (PAN), or the Internet.
[0072] Figure 4 The device structure shown in the figure does not constitute a limitation on the communication network, and may include more or less components than shown in the figure, or combine certain components, or arrange the components differently.
[0073] Next, the data storage method provided by the present application is described in detail with reference to the accompanying drawings. Figure 5 A schematic diagram of a data storage method provided in this application. Figure 4 The storage system shown in the figure is used as an example for explanation, that is, the application server 420 performs database operations and stores updated pages and transaction logs as an example for explanation. Figure 5 As shown, the method includes the following steps.
[0074] Step 510: Perform database operations on the database page to obtain an updated page.
[0075] The application server receives the database instructions sent by the client, performs database operations on the database page according to the database instructions, and generates transaction logs and updated pages. The instructions received by the application server include but are not limited to instructions for writing, modifying, and deleting data in the database.
[0076] After the application server modifies the data of the database page according to the database instruction, it needs to store the updated page and the transaction log of this database operation to ensure data consistency when the application server recovers data after a failure or updates the database page again.
[0077] In some embodiments, the application server identifies the transaction log and the updated page, stores the updated page in the memory, and stores the transaction log in the storage server. For example, a processor in the application server performs a data sensing operation, that is, identifying the updated page and the transaction log.
[0078] Step 520: Cache the updated page in the memory of the application server.
[0079] The page identifier and the updated page are cached in the memory of the application server. The page identifier is used to indicate the page and the updated page.
[0080] In some embodiments, the correspondence between the page identifier and the updated page is stored in the memory of the application server together with the updated page.
[0081] Optionally, the application server stores the page identifier, file address and page status corresponding to the updated page in a memory of the application server. For example, the page identifier, file address and page status are stored in the memory in a corresponding format.
[0082] Step 530: Store the transaction log corresponding to the updated page in the storage server.
[0083] The page identifier and the transaction log are stored in the storage server. The page identifier is used to indicate the page and the updated page.
[0084] In some embodiments, the application server transmits the identified transaction log and page identifier to the storage server via the network. The storage server stores the corresponding relationship between the page identifier and the transaction log and the transaction log in the storage array of the storage server.
[0085] In this way, since the application server does not need to transmit the updated page to the storage server, the bandwidth occupied between the application server and the storage server is reduced. In addition, there is no need to deploy a high-speed cache memory in the storage server, thereby reducing storage costs.
[0086] After storing the updated page in the memory and storing the transaction log in the storage server, the storage server can also perform page materialization operations and execute page materialization and elimination linkage mechanisms with the application server, as described in the following steps 540 and 560. Figure 6 A schematic diagram of the process of generating updated pages and invalidating updated pages provided for this application. Figure 6 As shown, the method includes the following steps.
[0087] Step 540: The storage server materializes the page according to the transaction log.
[0088] The storage server generates an updated page according to the transaction log, and stores the generated updated page to the storage array, that is, this operation can be called page materialization. In some embodiments, after the updated page is generated, a response message will be sent to the application server, and the elimination linkage mechanism will be executed, for example, step 550 will be executed.
[0089] Step 550: The storage server sends a response message to the application server.
[0090] After the storage server generates the updated page according to the transaction log, the storage server sends a response message to the application server. The response message is used to indicate the updated page indicated by the page identifier corresponding to the stored transaction log. For example, the response message includes the page identifier.
[0091] Step 560: Apply the updated page after the server fails.
[0092] After receiving the response message, the application server invalidates the updated page indicated by the response message.
[0093] In some embodiments, the response message may include a page identifier, and the application server invalidates the updated page indicated by the page identifier. For example, the application server stores the correspondence between the page identifier and the updated page, and the application server queries the correspondence between the page identifier and the updated page according to the page identifier included in the response message, and determines the updated page indicated by the page identifier in the correspondence, so that the application server invalidates the updated page indicated by the page identifier.
[0094] In other embodiments, the response message may include a file address corresponding to the updated page, and the file address may refer to a storage address storing the updated page in a file system format. The application server invalidates the updated page indicated by the file address. For example, the application server stores the correspondence between the page file address and the updated page, and the application server queries the correspondence between the page file address and the updated page according to the file address included in the response message, and determines the updated page indicated by the file address in the correspondence, so that the application server invalidates the updated page indicated by the file address.
[0095] In some other embodiments, the application server may further store a correspondence between at least one of the page identifier or the file address and the page status. The application server determines the updated page that needs to be invalidated based on the correspondence between at least one of the stored page identifier or the file address and the page status, and invalidates the updated page based on the page status. If the page status indicates that the updated page has been invalidated, there is no need to perform invalidation processing; if the page status indicates that the updated page has been invalidated, the application server invalidates the updated page based on the access characteristics of the updated page and the storage capacity of the memory.
[0096] In some embodiments, for example, a feature is used to determine whether the updated page is frequently accessed. If the access feature of the updated page indicates that the updated page is frequently accessed, the updated page can be called a hot page and the updated page does not need to be invalidated; if the access feature of the updated page indicates that the updated page is not frequently accessed, the updated page can be called a cold page and the updated page can be invalidated.
[0097] In other embodiments, the updated page stored in the application server memory is invalidated according to the storage capacity of the memory in the application server. For example, if the access characteristics of the updated page indicate that the updated page is frequently accessed, the updated page can be called a hot page and the updated page does not need to be invalidated; if the access characteristics of the updated page indicate that the updated page is not frequently accessed, the updated page can be called a cold page and the updated page can be invalidated.
[0098] Optionally, the application server invalidates the updated page stored in the memory of the application server according to the access characteristics of the updated page and the storage capacity of the memory.
[0099] In this way, the updated page stored in the application server is invalidated, and the storage space in the application server used for caching the updated page is released, so as to store the latest updated page obtained after performing database operations on the pages in the database.
[0100] The following describes the solution for the application server to query the updated page. Figure 7 As shown, the method includes the following steps.
[0101] Step 570: The application server obtains the updated page according to the query request.
[0102] The application server obtains the query request, which can be used to indicate that a database operation is to be performed on the updated page. The application server can then obtain the updated page from the cache. The query request can include a page identifier of the updated page.
[0103] In some embodiments, if the application server has invalidated the updated page in the cache, the application server may obtain the updated page from the storage server.
[0104] In other embodiments, when the database fails, the application server may obtain the updated page from the storage server.
[0105] In other embodiments, when the application server needs to restore data after a failure and restart, the updated page can be queried from the storage server. If the storage server does not store the updated page, the transaction log can be read to restore the updated page based on the transaction log.
[0106] Step 580: The application server obtains the updated page from the storage server.
[0107] When the updated page is not obtained from the memory of the application server, the updated page is obtained from the storage server.
[0108] In some embodiments, when the updated page is not obtained from the memory of the application server, it is obtained from the storage server, and if the updated page is already stored in the storage array, the updated page is returned to the application server.
[0109] In other embodiments, if the updated page in the storage array is not completely generated, the updated page is not returned temporarily, and the request waiting to read the transaction log and page is blocked. The storage server reads the transaction log according to the transaction log and the stored updated page, generates the page, and returns the request and the updated page after the updated page is generated.
[0110] In this way, since the updated page is cached in the application server, when the application server needs to perform database operations on the updated page, the updated page can be obtained as soon as possible. Solving the problem of long page recovery time can ensure the reliability and availability of the database.
[0111] Combined with the above Figures 1 to 7 , describes in detail the storage method provided by this application, and will be combined with Figure 8 , describing the data storage device provided according to the present application.
[0112] Figure 8 Schematic diagram of the structure of possible data storage devices provided by the present application. These data storage devices can be used to implement the functions of the application server or storage server in the above method embodiment, so as to achieve the beneficial effects of the above method embodiment. In this embodiment, the data storage device can be as follows: Figure 4 Device shown.
[0113] like Figure 8 As shown, the data storage device 800 includes a communication module 810, a processing module 820 and a storage module 830. The data storage device 800 is used to implement the above Figure 5 , Figure 6 or Figure 7 The method embodiments shown in FIG. 1 apply the functions of a server or a storage server.
[0114] The data storage device 800 is used to implement the above Figure 5 , Figure 6 or Figure 7 In the method embodiment shown in FIG, the functions of the application server are applied, and each module is specifically used to implement the following functions.
[0115] The communication module 810 is used to receive database instructions from the client.
[0116] Processing module 820 performs database operations on database pages according to database instructions; and is also used to identify updated pages and transaction logs. Figure 5Step 510.
[0117] The processing module 820 caches the updated page in the memory of the application server. For example, the processing module 820 is used to execute Figure 5 Step 520.
[0118] The storage module 830 is used to store the updated page.
[0119] The communication module 810 is used to store the transaction log corresponding to the updated page to the storage server. For example, the communication module 810 is used to execute Figure 5 Step 530.
[0120] The communication module 810 is also used to receive a response message sent by the storage server. For example, the communication module 810 is used to execute Figure 6 Step 550.
[0121] Processing module 820 is used to invalidate the updated page of the application server. For example, processing module 820 is used to execute Figure 6 Step 560.
[0122] Processing module 820 is used to read the updated page from the application server when the application server fails. For example, processing module 820 is used to execute Figure 7 Step 570.
[0123] The communication module 810 is used to send a message to the storage server to obtain the updated page message when the application server fails. For example, the communication module 810 is used to execute Figure 7 Step 580.
[0124] The data storage device 800 is used to implement the above Figure 5 , Figure 6 or Figure 7 The method embodiment shown in the figure stores the functions of the server, and each module is specifically used to implement the following functions.
[0125] The communication module 810 is used to receive the transaction log corresponding to the updated page of the application server. For example, the communication module 810 is used to execute Figure 5 Step 530.
[0126] The storage module 830 is used to store transaction logs.
[0127] The processing module 820 is used to materialize the page according to the transaction log. For example, the processing module 820 is used to execute Figure 6 Step 540.
[0128] The communication module 810 is used to send a response message to the application server. For example, the communication module 810 is used to execute Figure 6Step 550.
[0129] The communication module 810 is used to receive the application server fault read to obtain the updated page from the storage array. For example, the communication module 810 is used to execute Figure 7 Step 580.
[0130] Processing module 820 is used to retrieve the updated log in the storage array; if there is no updated log, it is generated based on the stored updated page and transaction log. For example, processing module 820 is used to execute Figure 7 Step 580.
[0131] It should be understood that the data storage device 800 of the embodiment of the present application can be implemented by an application-specific integrated circuit (ASIC) or a programmable logic device (PLD), and the PLD can be a complex programmable logical device (CPLD), a field-programmable gate array (FPGA), a generic array logic (GAL) or any combination thereof. It can also be implemented by software. Figure 5 , Figure 6 or Figure 7 The data storage method shown and its various modules may also be software modules, and the data storage device 800 and its various modules may also be software modules.
[0132] The data storage device 800 according to the embodiment of the present application may correspond to executing the method described in the embodiment of the present application, and the above and other operations and functions of each unit in the data storage device 800 are respectively to implement Figure 5 , Figure 6 or Figure 7 For the sake of brevity, the corresponding processes of each method in are not repeated here.
[0133] Fig. 9 A schematic diagram of a computer device provided for this application. Fig. 9 As shown, the computer device 900 includes a processor 910 , a bus 920 , a storage 930 , a communication interface 940 , and a memory 950 (also referred to as a main memory unit). The processor 910 , the storage 930 , the memory 950 , and the communication interface 940 are connected via the bus 920 .
[0134] It should be understood that in this embodiment, the processor 910 may be a CPU, and the processor 910 may also be other general-purpose processors, digital signal processors (DSP), ASICs, FPGAs or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc.
[0135] The communication interface 940 is used to implement the communication between the computer device 900 and an external device or device. Figure 5 , Figure 6 , Figure 7 The function of the application server shown is that the communication interface 940 is used to obtain database operation instructions so that the processor 910 can instruct to execute database operations, obtain transaction logs and generate post-pages. The communication interface 940 is also used to transmit transaction logs and store the transaction logs in a storage array.
[0136] The bus 920 may include a path for transmitting information between the above components (such as the processor 910, the memory 950, and the storage 930). In addition to the data bus, the bus 920 may also include a power bus, a control bus, and a status signal bus. However, for the sake of clarity, various buses are labeled as bus 920 in the figure. The bus 920 may be a Peripheral Component Interconnect Express (PCIe) bus, or an extended industry standard architecture (EISA) bus, a unified bus (Ubus or UB), a computer express link (CXL), a cache coherent interconnect for accelerators (CCIX), etc. The bus 920 can be divided into an address bus, a data bus, a control bus, etc.
[0137] As an example, the computer device 900 may include multiple processors. The processor may be a multi-core (multi-CPU) processor. The processor here may refer to one or more devices, circuits, and / or computing units for processing data (e.g., computer program instructions).
[0138] It is worth mentioning that Fig. 9In the example, a computer device 900 including a processor 910 and a memory 930 is taken as an example. Here, the processor 910 and the memory 930 are respectively used to indicate a type of device or equipment. In a specific embodiment, the number of each type of device or equipment can be determined according to business requirements.
[0139] The memory 950 may be a volatile memory pool or a non-volatile memory pool, or may include both volatile and non-volatile memories. Among them, the non-volatile memory may be a read-only memory (ROM), a programmable ROM (PROM), an erasable PROM (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. The volatile memory may be a random access memory (RAM), which is used as an external cache. By way of example but not limitation, many forms of RAM are available, such as static RAM (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDR SDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link dynamic random access memory (SLDRAM) and direct rambus RAM (DR RAM). Memory 950 is used to store updated pages.
[0140] The memory 930 may correspond to the storage medium used to store the updated page in the above method embodiment, for example, a disk such as a mechanical hard disk or a solid state disk.
[0141] It should be understood that the computer device 900 according to this embodiment may correspond to the data storage device 800 in this embodiment, and may correspond to executing the Figure 5 , Figure 6 or Figure 7 The corresponding subject in any method, and the above operations of each module in the data storage device 800 are respectively to realize Figure 5 , Figure 6 or Figure 7 For the sake of brevity, the corresponding processes of each method in are not repeated here.
[0142] The present application provides a storage system, which includes a client, an application server and a storage server. The client, the application server and the storage server include multiple components. The application server and the storage server are used to execute the operating steps of the data storage method described in the above method embodiment to realize the storage of transaction logs and updated pages.
[0143] The method steps in this embodiment can be implemented by hardware or by a processor executing software instructions. The software instructions can be composed of corresponding software modules, and the software modules can be stored in random access memory (RAM), flash memory, read-only memory (ROM), programmable ROM (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), registers, hard disks, mobile hard disks, CD-ROMs, or any other form of storage medium known in the art. An exemplary storage medium is coupled to the processor so that the processor can read information from the storage medium and write information to the storage medium. Of course, the storage medium can also be a component of the processor. The processor and the storage medium can be located in an ASIC. In addition, the ASIC can be located in a computing device. Of course, the processor and the storage medium can also exist as discrete components in the client, application server, and storage server.
[0144] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented by software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer programs or instructions. When the computer program or instruction is loaded and executed on a computer, the process or function described in the embodiment of the present application is executed in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, a network device, a user device or other programmable device. The computer program or instruction may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium, for example, the computer program or instruction may be transmitted from one website site, computer, server or data center to another website site, computer, server or data center by wired or wireless means. The computer-readable storage medium may be any available medium that a computer can access or a data storage device such as a server or data center that integrates one or more available media. The available medium may be a magnetic medium, for example, a floppy disk, a hard disk, a tape; it may also be an optical medium, for example, a digital video disc (DVD); it may also be a semiconductor medium, for example, a solid state drive (SSD).
[0145] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of various equivalent modifications or replacements within the technical scope disclosed in the present application, and these modifications or replacements should be included in the protection scope of the present application. Therefore, the protection scope of the present application shall be based on the protection scope of the claims.
Claims
1. A data storage method, characterized in that: The application server is connected to the storage server, the application server is used to run the database, and the storage server is used to store database data. The method includes: Perform database operations on the database page to obtain the updated page; caching the updated page in a memory of the application server; The transaction log corresponding to the updated page is stored in the storage server.
2. The method according to claim 1, characterized in that Caching the updated page in a memory of the application server includes: The page identifier and the updated page are cached in the memory of the application server, wherein the page identifier is used to indicate the page and the updated page.
3. The method according to claim 1 or 2, characterized in that: Storing the transaction log corresponding to the updated page in the storage server includes: The page identifier and the transaction log are stored in the storage server, the page identifier and the transaction log have a corresponding relationship, and the page identifier is used to indicate the page and the updated page.
4. The method according to any one of claims 1 to 3, characterized in that The method further comprises: receiving a response message sent by the storage server, wherein the response message is used to indicate that the updated page indicated by the page identifier corresponding to the transaction log has been stored; The updated page stored in the memory of the application server is invalidated.
5. The method according to claim 4, characterized in that Invalidating the updated page stored in the memory of the application server, comprising: The updated page stored in the memory of the application server is invalidated according to the access characteristics of the updated page.
6. The method according to claim 4, characterized in that Invalidating the updated page stored in the memory of the application server, comprising: The updated page stored in the memory of the application server is invalidated according to the storage capacity of the memory in the application server.
7. The method according to any one of claims 1 to 6, characterized in that The method further comprises: The updated page is obtained from the memory of the application server according to the query request.
8. The method according to any one of claims 1 to 6, characterized in that The method further comprises: When the updated page is not read from the memory of the application server, the updated page is obtained from the storage server.
9. A data storage device, characterized in that: include: Communication module, used to obtain database operations; A processing module is used to perform database operations on the pages of the database to obtain updated pages; The processing module is further used to cache the updated page in the memory of the application server; The processing module is further used to store the transaction log corresponding to the updated page in the storage server.
10. A computer device, characterized in that: The computer device includes a memory and multiple processors, the memory is used to store a group of computer instructions; when the processor executes the group of computer instructions, the operation steps of the method described in any one of claims 1 to 8 are performed.
11. A storage system, characterized in that: The storage system includes an application server and a storage server. The application server is used to execute the operation steps of the method described in any one of claims 1 to 8 to cache database pages, and the storage server is used to persistently store database pages.
Citation Information
Cited By
Data storage method and apparatus, computer device, and storage system
EP4783021A1
Data storage method and apparatus, computer device, and storage system
WO2025066137A1