A data management method, device, equipment and storage medium thereof

By generating shared memory and allocating metadata on the storage side, the problems of poor reading performance and low cache hit rate in the parallel file system are solved, and the database can directly read and write the metadata of the shared disk array, improving efficiency and hit rate. .

CN116662264BActive Publication Date: 2024-10-18SHENZHEN INST OF COMPUTING SCI
View PDF 10 Cites 0 Cited by

Patent Information

Application Number
CN202310654147.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-06-02
Publication Date
2024-10-18
Estimated Expiration
2043-06-02

AI Technical Summary

Technical Problem

In the parallel file system, the existing technology has the problem that each read requires a round trip between the client and the server, has poor performance, and has a low cache hit rate.

Method used

By initializing the shared memory on the storage side, and when the storage side receives the client's metadata update request, the metadata to be updated is allocated to the shared memory, including directories, files, and file partition tables. The client can directly access the shared memory from the shared memory. Read target metadata for direct reading and writing.

Benefits of technology

It improves the reading and writing efficiency of the database, reduces memory usage and network overhead, ensures a high hit rate of metadata, and avoids miss problems.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116662264B_ABST
    Figure CN116662264B_ABST
Patent Text Reader

Abstract

The present application provides a data management method, device, equipment and storage medium thereof, the method involving a storage end and a client, the method comprising: the storage end receives a connection request sent by the client, and determines a key value corresponding to a shared memory according to the connection request, and sends the key value to the client, wherein the shared memory is generated by initialization processing of the storage end; when the storage end receives a metadata update request sent by the client, the storage end determines metadata to be updated according to the metadata update request, and allocates the metadata to be updated to the shared memory, wherein the metadata to be updated includes directories, files and file partition tables. The client calculates the location of the file in the shared disk through the shared memory, and reads and writes it. The hit rate and read-write efficiency of the metadata are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of data management, and in particular to a data management method, apparatus, device and storage medium thereof. Background Art

[0002] In a cluster database based on a shared storage architecture, database instances are run on multiple physical hosts. These instances will concurrently read and write the same data, including but not limited to database control files, data files, log files, etc. During operation, these instances will concurrently read and write the same file, and may also create, delete files, and organize files in directories. This often requires a parallel file system to manage the disks divided on the shared storage and provide an interface for the directory file for the database to use, such as GPFS, to meet the above database requirements. However, the performance of these general file systems is difficult to be satisfactory.

[0003] In a parallel file system, there are two main methods for managing file system metadata: file system server management only and file system server management + client cache.

[0004] Among them, in the file system server-only management: that is, only the file system server manages metadata information; the client does not cache metadata information; the file system master instance is responsible for updating metadata and synchronizing such updates to other file system non-master instances; when the business side needs to read user data, it needs to forward the request to the file system server, and the file system server returns it to the business side after successful reading; each read requires a round trip between the client and the server, and the performance is very poor.

[0005] In file system server management + client cache: This is an improvement based on file system server management only; that is, the file system server manages metadata information, but the client manages the cache of part of the metadata; when the business side reads user data, if the metadata information is hit in the cache, the location of the file on the shared disk array can be calculated, and direct reading and writing can be performed; although the read and write efficiency is improved; but the cache still has a hit rate problem. Summary of the invention

[0006] In view of the above problems, the present application is proposed to provide a data management method, apparatus, device and storage medium thereof that overcome the above problems or at least partially solve the above problems, including:

[0007] A data management method, the method involving a storage end and a client, wherein the storage end is used to process metadata, the processing including update processing and read-write processing, and the method comprising:

[0008] The storage end receives a connection request sent by the client, determines a key value corresponding to a shared memory according to the connection request, and sends the key value to the client, wherein the shared memory is generated by initialization processing of the storage end;

[0009] When the storage end receives the metadata update request sent by the client, the storage end determines the metadata to be updated according to the metadata update request, and allocates and processes the metadata to be updated to the shared memory, wherein the metadata to be updated includes directories, files, and file partition tables.

[0010] Furthermore, the step of generating the shared memory by initialization processing of the storage end includes:

[0011] Determine the target shared disk based on the preset configuration information.

[0012] When it is detected that the target shared disk is not formatted, the storage end formats the target shared disk according to the preset configuration information, and initializes the target shared disk to obtain BOOT information;

[0013] The storage end determines the number information according to the BOOT information;

[0014] The storage end constructs a corresponding number of to-be-initialized shared memories according to the number of the number information, wherein at least one of the to-be-initialized shared memories is used to store the manager information;

[0015] The storage end determines the disk location corresponding to each shared memory to be initialized according to the manager information;

[0016] The storage end adds the initial metadata to the corresponding shared memory to be initialized in the target disk according to the disk position, and marks the initialized shared memory as the shared memory after the initial metadata is added.

[0017] Further, the step of determining the metadata to be updated according to the metadata update request, and allocating the metadata to be updated to the shared memory, wherein the metadata to be updated includes directories, files, and file partition tables, comprises:

[0018] The storage end determines whether there is a first target data block corresponding to the metadata to be updated according to the metadata to be updated;

[0019] When the first target data block does not exist, the storage end determines whether there is an unused data block in the current shared memory;

[0020] When the current shared memory does not contain the unused data block, the storage end generates a request to construct a shared memory;

[0021] The storage end constructs a target shared memory according to the shared memory construction request;

[0022] The storage end determines a second target data block in the target shared memory for storing the metadata to be updated, and writes the metadata to be updated into the second target data block.

[0023] The embodiment of the present invention further provides a data management method, the method involving a storage end and a client, wherein the storage end is used to process metadata, the processing includes update processing and read-write processing, and the method includes:

[0024] When detecting that the database instance is started, the client generates a connection request and sends the connection request to the storage end;

[0025] When the client receives the key value sent by the storage end, the client connects to the shared memory according to the key value;

[0026] When the client has a task to be updated, the client generates a metadata update request according to the metadata to be updated in the task to be updated, and sends the metadata update request to the storage end;

[0027] When the client has a service data read / write request, the client reads the target file according to the service data read / write request and the target metadata in the shared memory.

[0028] Furthermore, the step of reading the target file according to the business data read / write request and the target metadata in the shared memory includes:

[0029] The client determines the target metadata according to the read / write request;

[0030] The client determines the target disk location according to the target metadata;

[0031] The client obtains the target file according to the target disk location.

[0032] Furthermore, the step of determining the target metadata according to the read / write request includes:

[0033] The client obtains all metadata in the shared memory according to the read / write request;

[0034] The client determines all data blocks corresponding to all metadata according to all metadata;

[0035] When all the data blocks are not in the existing shared memory, the client queries the target manager information of the existing shared memory, and determines whether there is a new shared memory to be loaded through the target manager information;

[0036] When the new shared memory needs to be loaded, the client obtains the slot information and the target key value in the target manager information to generate the new shared memory;

[0037] The client determines a third target data block according to the new shared memory;

[0038] The client determines the target metadata according to the third target data block.

[0039] The embodiment of the present invention further provides a data management device, the device involves a storage end and a client end, wherein the storage end is used to process metadata, the processing includes update processing and read and write processing, and the device includes:

[0040] A first sending module, configured for the storage end to receive a connection request sent by the client, and to determine a key value corresponding to a shared memory according to the connection request, and to send the key value to the client, wherein the shared memory is generated by initialization processing of the storage end;

[0041] The first allocation module is used to determine the metadata to be updated according to the metadata update request when the storage end receives the metadata update request sent by the client, and allocate the metadata to be updated to the shared memory, wherein the metadata to be updated includes directories, files and file partition tables.

[0042] The embodiment of the present invention further provides a data management device, the device involves a storage end and a client end, wherein the storage end is used to process metadata, the processing includes update processing and read and write processing, and the device includes:

[0043] A second sending module, configured to, when detecting that a database instance is started, cause the client to generate a connection request and send the connection request to the storage end;

[0044] A first connection module, configured to connect the client to the shared memory according to the key value when the client receives the key value sent by the storage end;

[0045] A third sending module, configured to, when there is a task to be updated on the client, cause the client to generate a metadata update request according to the metadata to be updated in the task to be updated, and send the metadata update request to the storage end;

[0046] The first reading module is used for, when the client has a business data read / write request, the client reads the target file according to the business data read / write request and the target metadata in the shared memory.

[0047] An embodiment of the present invention further provides a computer device, including a processor, a memory, and a computer program stored in the memory and capable of running on the processor, wherein the computer program implements the steps of a data management method as described above when executed by the processor.

[0048] An embodiment of the present invention further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the data management method described above are implemented.

[0049] This application has the following advantages:

[0050] In an embodiment of the present application, relative to the prior art that "each read requires a round trip between the storage end and the server end, the performance is very poor, and the cache still has a hit rate problem", the present application provides a solution of "a data management method", specifically: "The storage end receives the connection request sent by the client, and determines the key value corresponding to the shared memory based on the connection request, and sends the key value to the client, wherein the shared memory is generated by the initialization processing of the storage end; when the storage end receives the metadata update request sent by the client, the storage end determines the metadata to be updated based on the metadata update request, and allocates the metadata to be updated to the shared memory, wherein the metadata to be updated includes directories, files and file partition tables". The "storage side" solves the problem of "each read requires a round trip between the client and the server, the performance is very poor, and the cache still has a hit rate", and achieves the effect of "the database can determine the location of the data file on the shared disk array through the metadata information in the shared memory, and then perform direct reading and writing, which greatly improves the database reading and writing efficiency. The database and the file system share memory, which reduces memory usage and improves the hit rate of metadata on the database side compared to the method of the database caching file system metadata or caching part of the metadata; the database uses shared memory for files, and compared to the database throwing read and write requests and metadata update requests to the file system instance for processing, it not only improves the reading and writing efficiency, but also reduces network overhead." BRIEF DESCRIPTION OF THE DRAWINGS

[0051] In order to more clearly illustrate the technical solution of the present application, the drawings required for use in the description of the present application will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.

[0052] Figure 1 It is a flowchart of a data management method provided by an embodiment of the present application;

[0053] Figure 2 It is a flowchart of a data management method provided by an embodiment of the present application;

[0054] Figure 3 is a structural block diagram of a data management device provided by an embodiment of the present application;

[0055] Figure 4 is a structural block diagram of a data management device provided by an embodiment of the present application;

[0056] Figure 5 It is a structural schematic diagram of a computer device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0057] In order to make the objects, features and advantages of the present application more obvious and understandable, the present application is further described in detail below in conjunction with the accompanying drawings and specific implementation methods. Obviously, the described embodiments are part of the embodiments of the present application, rather than all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in the field without creative work are within the scope of protection of the present application.

[0058] The inventors have found through analysis of the prior art that in a parallel file system, there are two main methods for managing file system metadata: file system server management only and file system server management + client cache.

[0059] 1. Only the file system server manages metadata information: that is, only the file system server manages metadata information. The client does not cache metadata information; the file system master instance is responsible for updating metadata and synchronizing such updates to other file system non-master instances; when the business side needs to read user data, it needs to forward the request to the file system server, which will return it to the business side after successful reading. Each read requires a round trip between the client and the server, and the performance is very poor.

[0060] 2. File system server management + client cache: This is an improvement based on file system server management only; that is, the file system server manages metadata information, but the client manages the cache of some metadata; when the business side reads user data, if the metadata information is hit in the cache, the location of the file on the shared disk array can be calculated and read and written directly. Compared with file system server management only, the read and write efficiency is greatly improved; but there is a hit rate problem with the cache.

[0061] The following prior art was retrieved:

[0062] Prior art 1: The application number is "200910085706.1", the announcement date is "May 16, 2012", and the patent name is "Management and allocation method of resources in parallel file system". In this patent, all metadata is on the file system server, and the client has a cache of metadata. The following is an analysis of its shortcomings through the reading process

[0063] Reading process:

[0064] 1. When accessing a file for read, the client first checks whether the metadata of the corresponding file is cached locally. If so, it jumps to 3.

[0065] 2. If the client cache does not hit, the interaction module will be used to pull metadata from the server and update it to the client local cache;

[0066] 3 At this time, the client can obtain file partition information through the local cache and read data.

[0067] It can be seen that the method of caching metadata on the client side in the prior art 1 has certain hit rate problems. However, the technical solution of the present application stores all metadata in the shared memory, and there is no miss problem.

[0068] Prior art 2: The application number is "201210385489.X", the announcement date is "February 27, 2013", and the patent name is "A method for optimizing disk database performance using memory database technology", wherein the invention provides a method for optimizing disk database performance using memory database technology. The memory database and middleware application are installed and deployed on a server with a large memory, and then the hot data stored in the disk database, including read-only data and readable and writable data, are cached in the memory, and the corresponding data synchronization method is configured to automatically synchronize the changed data in the memory to the disk database to ensure data reliability. By using the memory database technology, the hot data stored on the disk is cached in the memory, and the application is modified to configure the original request for the data in the disk to request the data in the memory, even if the operation on the disk is changed to the operation on the memory, the I / O bottleneck in the traditional disk database system is eliminated, and the performance of the system is greatly improved.

[0069] Prior art 2 caches the hot data of the disk database to the memory database, which is equivalent to adding a layer of high-speed cache between the disk database and the business side to reduce the I / O bottleneck of the disk database. The technical solution of this application is to put all metadata in "shared memory", and the business side calculates the actual location of the file in the SAN through metadata and performs direct I / O operations; compared with this application, prior art 2 uses memory, but the shared memory used in this application has different implementations; in addition, the two do not solve the same type of problems.

[0070] Based on the problems of the prior art 1 and the prior art 2 respectively and the problems in the management method of the file system metadata, the present application proposes a solution to put all metadata in the shared memory, so that the file system server and the client can see the same metadata information; when the business side reads user data, it can directly read the metadata information in the shared memory, calculate the location of the file in the shared magnetic array, and do direct I / O; because the metadata information seen by the client and the server is consistent, there is no miss problem; the technical solution of the present application is specifically described as follows:

[0071] Reference Figure 1 , showing a step flow chart of a data management method provided by an embodiment of the present application;

[0072] A data management method, the method involving a storage end and a client, wherein the storage end is used to process metadata, the processing including update processing and read-write processing, and the method comprising:

[0073] S110, the storage end receives a connection request sent by the client, determines a key value corresponding to a shared memory according to the connection request, and sends the key value to the client, wherein the shared memory is generated by initialization processing of the storage end;

[0074] S120. When the storage end receives the metadata update request sent by the client, the storage end determines the metadata to be updated according to the metadata update request, and allocates the metadata to be updated to the shared memory, wherein the metadata to be updated includes directories, files, and file partition tables.

[0075] In an embodiment of the present application, relative to the prior art that "each read requires a round trip between the storage end and the server end, the performance is very poor, and the cache still has a hit rate problem", the present application provides a solution of "a data management method", specifically: "The storage end receives the connection request sent by the client, and determines the key value corresponding to the shared memory based on the connection request, and sends the key value to the client, wherein the shared memory is generated by the initialization processing of the storage end; when the storage end receives the metadata update request sent by the client, the storage end determines the metadata to be updated based on the metadata update request, and allocates the metadata to be updated to the shared memory, wherein the metadata to be updated includes directories, files and file partition tables". The "storage side" solves the problem of "each read requires a round trip between the client and the server, the performance is very poor, and the cache still has a hit rate", and achieves the effect of "the database can determine the location of the data file on the shared disk array through the metadata information in the shared memory, and then perform direct reading and writing, which greatly improves the database reading and writing efficiency. The database and the file system share memory, which reduces memory usage and improves the hit rate of metadata on the database side compared to the method of the database caching file system metadata or caching part of the metadata; the database uses shared memory for files, and compared to the database throwing read and write requests and metadata update requests to the file system instance for processing, it not only improves the reading and writing efficiency, but also reduces network overhead."

[0076] Next, a data management method in this exemplary embodiment will be further described.

[0077] It should be noted that file operations are divided into metadata update processing (such as creating files, extending file size, etc.) and read and write processing. These two types of processing are separated. That is, when writing a file, the file size cannot be expanded, the file attributes cannot be modified, etc. at the same time.

[0078] It should be noted that the key value is sent to the client via a heartbeat packet.

[0079] It should be noted that the heartbeat packet is a self-defined command word that periodically notifies the storage end and the server of their own status. It is sent at a certain time interval, similar to the heartbeat, so it is called a heartbeat packet; the reception and transmission of data in the network are implemented using sockets, but if the socket has been disconnected, there will be problems when sending and receiving data. As for how to determine whether the socket can still be used, it is necessary to create a heartbeat mechanism in the system; in fact, the transmission control protocol has implemented a mechanism called heartbeat for us. If the heartbeat is set, the transmission control protocol will send the set number of heartbeats (for example, 2 times) within a certain period of time (for example, it is set to 3 seconds), and this information will not affect the custom protocol; the so-called "heartbeat" is to send a custom structure (heartbeat packet or heartbeat frame) at a certain time to let the other party know that we are "online" to ensure the validity of the link; the so-called heartbeat packet is that the storage end sends a simple message to the server end at a certain time to tell it that it is still there. The code is to send a fixed message to the server every few minutes, and the server will reply with a fixed message after receiving it. If the server does not receive the storage end information within a few minutes, the storage end is considered disconnected. For example, if some communication software is not used for a long time, if you want to know whether it is online or offline, you need a heartbeat packet, which is sent and received regularly. The sender: It can be the client or the server, depending on which side is convenient and reasonable to implement. Generally, it is the storage end. The server can also periodically poll and send heartbeats. The heartbeat packet is called a heartbeat packet because: it is sent at fixed intervals like a heartbeat to tell the server that the storage end is still alive. In fact, this is to maintain a long connection. As for the content of this packet, there is no special regulation, but it is generally a very small packet, or an empty packet containing only a header.

[0080] As an example, there are two ways for a database instance to obtain the key value corresponding to the newly applied or newly constructed shared memory:

[0081] The first way: A heartbeat is maintained between the database instance and the file system instance. The key value of the shared memory can be returned to the database instance through the heartbeat packet. When the database instance finds that the key value has been added, it knows that the new application has newly built the shared memory and can connect.

[0082] The second method: When the database instance is reading or writing a file, if it finds that the file partition does not exist in the current shared memory, it queries the file system for the key value of the shared memory, obtains the key value, and then connects.

[0083] In a specific implementation, the storage end receives a connection request sent by the client, obtains a key value of the shared memory through the connection request, and sends the key value to the client.

[0084] In one embodiment of the present invention, after receiving a metadata update request, the file system instance allocates metadata information in a shared memory according to preset rules; the file system instance service synchronizes the metadata modification to other file system instances through an inter-cluster synchronization processing thread.

[0085] In one embodiment of the present invention, when the database reads and writes a file, it directly calculates the actual storage location of the file in the shared disk array through the metadata information in the shared memory, and then directly performs the read and write operations.

[0086] In one embodiment of the present invention, the step of generating the shared memory by initialization processing of the storage end includes:

[0087] Determine the target shared disk based on the preset configuration information.

[0088] When it is detected that the target shared disk is not formatted, the storage end formats the target shared disk according to the preset configuration information, and initializes the target shared disk to obtain BOOT information;

[0089] The storage end determines the number information according to the BOOT information;

[0090] The storage end constructs a corresponding number of to-be-initialized shared memories according to the number of the number information, wherein at least one of the to-be-initialized shared memories is used to store the manager information;

[0091] The storage end determines the disk location corresponding to each shared memory to be initialized according to the manager information;

[0092] The storage end adds the initial metadata to the corresponding shared memory to be initialized in the target disk according to the disk position, and marks the initialized shared memory as the shared memory after the initial metadata is added.

[0093] It should be noted that the shared disk is a disk array. A disk array is a disk group formed by combining multiple independent hard disks in different ways, thereby providing higher storage performance than a single hard disk and providing data backup technology. The different ways of forming a disk array are called magnetic array levels. The function of data backup is to use the backup information to restore the damaged data once the user data is damaged, thereby ensuring the security of the user data. To the user, the disk group is like a hard disk, and the user can partition and format it. It has the two major characteristics of high speed and security.

[0094] It should be noted that the BOOT information is boot information.

[0095] It should be noted that the size of shared memory is not fixed. As the business continues to run, the metadata continues to increase, and the current shared memory can no longer meet the demand, then another piece of shared memory of the same size will be applied for and built, and synchronized to other file system instances; the number of shared memory allocated is determined by the configuration file, that is, the preset configuration information.

[0096] It should be noted that the number information refers to the number of shared memories stored by the shared memory manager, ie, the manager information.

[0097] It should be noted that the manager information refers to the shared memory manager, which manages these shared memories of the same size through the shared memory manager; the shared memory manager itself is also a shared memory, which has multiple slots for recording the shared memory that has been applied for in the system and the location where its data is stored on the target shared disk. The data recorded in the shared memory will eventually be stored on the shared disk array; each piece of shared memory will eventually be stored on the fixed hard disk through the redo log file; the number of slots is given through the configuration file, i.e. the preset configuration information, when the file system is started for the first time.

[0098] As an example, in the process of determining whether the target shared disk is formatted, if it is formatted, the BOOT information can be directly obtained.

[0099] As an example, the initial metadata is not stored in the shared memory to be initialized, and the corresponding initial metadata needs to be added to the shared memory to be initialized through the disk location before the shared memory is formed.

[0100] As an example, when the file system is started, a shared memory is first requested to store metadata information.

[0101] As an example, at least one shared memory to be initialized is used to store manager information, and a shared memory to be initialized is constructed by applying first to store manager information of a shared memory manager.

[0102] As an example, the shared memory is not allocated enough shared memory at one time; instead, a block of shared memory is allocated first, and the size of a block of shared memory is 32M, and the 32M shared memory is divided into data blocks of 4K. When using, a data block is first allocated from the shared memory, and then the data block is used to store metadata.

[0103] In a specific implementation, after loading the configuration file, i.e., the preset configuration information, it is determined whether the target shared disk is formatted. If not, the target shared disk needs to be formatted. The number of metadata of the shared memory is determined according to the configuration file, i.e., the preset configuration information, which is used to determine the number of slots of the shared memory manager. After the formatting process is completed, the BOOT information is obtained in the target shared disk, and the shared memory is generated through the BOOT information.

[0104] In a specific implementation, first apply for a block of shared memory to be initialized and initialize it, and the shared memory to be initialized is used to store manager information; according to the number of shared memories saved by the shared memory manager in the BOOT information, apply for or build the shared memory, wherein the size of each shared memory block is 32M; determine the disk location corresponding to each shared memory block according to the shared memory manager, load the initial metadata from the corresponding disk location, and flush the initial metadata into or add it to the shared memory.

[0105] In one embodiment of the present invention, the step of determining the metadata to be updated according to the metadata update request, and allocating the metadata to be updated to the shared memory, wherein the metadata to be updated includes directories, files, and file partition tables, comprises:

[0106] The storage end determines whether there is a first target data block corresponding to the metadata to be updated according to the metadata to be updated;

[0107] When the first target data block does not exist, the storage end determines whether there is an unused data block in the current shared memory;

[0108] When the current shared memory does not contain the unused data block, the storage end generates a request to construct a shared memory;

[0109] The storage end constructs a target shared memory according to the shared memory construction request;

[0110] The storage end determines a second target data block in the target shared memory for storing the metadata to be updated, and writes the metadata to be updated into the second target data block.

[0111] It should be noted that the current shared memory is not the target shared memory, and the target shared memory is newly constructed.

[0112] It should be noted that after the file system is integrated with the database, the database creates directories, files, modifies file sizes, and other metadata modification operations through the file system storage end, and sends them to the file system instance for processing through UDS (UDS protocol is ISO14229, which is Unified Diagnostic Services, a standardized standard for diagnostic services). After the processing is completed, the directory, file, and file partition table will be updated to the shared memory in a certain organizational form; in a specific embodiment, the metadata update involves creating directories, modifying directories, deleting directories, creating files, deleting files, extending files, truncating files, etc.; these operations involving modifying metadata all require the file system storage end to send the request to the server end for processing through UDS. After the processing is completed, the metadata will be written to the shared memory; and passed to other file system nodes in the cluster.

[0113] As an example, when a metadata update request is received, it is first determined whether the first target data block to which the metadata to be updated belongs already exists. If it does exist, the metadata to be updated is directly written to the first target data block.

[0114] As an example, the storage end determines whether there is an unused data block in the current shared memory; when the unused data block exists in the current shared memory, an unused data block is requested from the current shared memory and recorded in a redo log file.

[0115] In a specific implementation, when a metadata update request is received, it is first determined whether the first target data block to which the metadata to be updated belongs already exists. If not, it is checked whether there are any unused data blocks that can be used in the current shared memory. If not, a request for building a shared memory is generated. By building a shared memory request, a slot is applied for in the metadata shared memory management, and a target shared memory is applied for and built. The size of the target shared memory is 32M, which is initialized as shared memory metadata, placed in the slot, and recorded in a redo log file. The file system instance lands the data on the shared magnetic array through the redo log file; a new data block, namely the second target data block, is applied from the target shared memory and recorded in the redo log file; the metadata to be updated is written to the second target data block and recorded in the redo log file; at this point, the update processing of the metadata to be updated is completed.

[0116] Reference Figure 2 , showing a step flow chart of a data management method provided by an embodiment of the present application;

[0117] A data management method, the method involving a storage end and a client, wherein the storage end is used to process metadata, the processing including update processing and read-write processing, and the method comprising:

[0118] S210, when detecting that the database instance is started, the client generates a connection request and sends the connection request to the storage end;

[0119] S220: When the client receives the key value sent by the storage end, the client connects to the shared memory according to the key value;

[0120] S230: When the client has a task to be updated, the client generates a metadata update request according to the metadata to be updated in the task to be updated, and sends the metadata update request to the storage end;

[0121] S240: When the client has a business data read / write request, the client reads the target file according to the business data read / write request and the target metadata in the shared memory.

[0122] It should be noted that the client includes a database and a database instance, wherein the database instance is an application program that accesses the database and is a layer of data management software located between the user and the operating system. In MySQL, it is the MySQL process. It is impossible and not allowed for users to directly operate database files through the file system to add, delete, check, modify, and perform any operations on files (data) in the database, including data definition, data query, data maintenance, and database operation control. This requires the help of a database instance, that is, these operations are all performed under the database instance. The database instance is the channel for users (programmers) to access the database. The application program can only interact with the database through the database instance. The database instance, as an application program, realizes the encapsulation of database operations and also realizes the parsing of the SQL language Q, allowing users to operate the database content in a simple and direct way using the SQL language. Generally speaking, a database instance corresponds to a database.

[0123] It should be noted that the database manages data files in large granularity and does not frequently create or modify file sizes, which involves metadata updates. However, it has high requirements for file reading and writing. When reading and writing files, directly querying metadata through shared memory, determining the location of the file in the shared disk array, and directly reading and writing the shared disk array can improve the reading and writing performance.

[0124] As an example, the storage end updates the metadata according to the received metadata update request; since the metadata is stored in the shared memory, the client can also see the updated metadata at this time.

[0125] In a specific implementation, when the database instance is started, it communicates with the storage end of the file system to obtain the key value of the shared memory in the storage end, and connects to the shared memory after receiving the key value.

[0126] In one embodiment of the present invention, the step of reading the target file according to the business data read / write request and the target metadata in the shared memory includes:

[0127] The client determines the target metadata according to the business data read and write request;

[0128] The client determines the target disk location according to the target metadata;

[0129] The client obtains the target file according to the target disk location.

[0130] It should be noted that when the database reads and writes files, it directly calculates the actual storage location of the file in the target shared disk through the metadata information in the shared memory, and then directly performs read and write operations; wherein, the file size cannot be updated at the same time when writing a file; in a specific embodiment, when the database system reads and writes, it queries the metadata in the shared memory through the file system storage end to determine the location of the target file on the target shared disk, and then directly reads and writes.

[0131] In a specific implementation, the client first reads all metadata, and when reading all metadata, checks whether the data blocks corresponding to all metadata are in the existing shared memory; if not, queries the shared memory manager whether there is new shared memory that needs to be loaded; if so, loads the shared memory according to the specific slot information and target key value of the shared memory manager, that is, generates new shared memory; determines the third target data block from the new shared memory; and reads metadata information, that is, target metadata, from the third target data block; determines the position of the target metadata in the target shared side, that is, the target disk position, through the target metadata, and obtains the target file through the target disk position.

[0132] In an embodiment of the present invention, the step of determining the target metadata according to the business data read / write request includes:

[0133] The client obtains all metadata in the shared memory according to the business data read and write request;

[0134] The client determines all data blocks corresponding to all metadata according to all metadata;

[0135] When all the data blocks are not in the existing shared memory, the client queries the target manager information of the existing shared memory, and determines whether there is a new shared memory to be loaded through the target manager information;

[0136] When the new shared memory needs to be loaded, the client obtains the slot information and the target key value in the target manager information to generate the new shared memory;

[0137] The client determines a third target data block according to the new shared memory;

[0138] The client determines the target metadata according to the third target data block.

[0139] As an example, when all the data blocks exist in the existing shared memory, the target metadata may be directly read from all the data blocks.

[0140] As an example, when there is no new shared memory to be loaded, an error message is prompted and the process ends.

[0141] In a specific implementation, all metadata in the shared memory are obtained through business data read and write requests, all data blocks corresponding to all metadata are determined in all metadata, and it is judged whether all data blocks are in the existing shared memory. When all data blocks are not in the existing shared memory, the target manager information of the existing shared memory is queried, and it is determined whether there is a new shared memory to be loaded through the target manager information; when there is a new shared memory to be loaded, the slot information and target key value in the target manager information are obtained to generate a new shared memory, and a third target data block is determined through the new shared memory; and the target metadata is determined through the third target data block.

[0142] In one embodiment of the present invention, the present application proposes a data management method to improve the performance of the file system and reduce its overhead. The specific measures include:

[0143] 1. Use large file partitions. Databases are different from general file systems. There are no large numbers of small files. Using large file partitions (this technical solution uses 8M large partitions) can greatly reduce metadata space usage. This results in a larger file allocation granularity to a certain extent, but this is completely acceptable for applications such as databases.

[0144] Second, file system metadata resides in memory. When the file system metadata space is small, it is possible to keep it in memory, which makes it impossible for the read operation of the file system metadata to encounter cache misses.

[0145] 3. Directly connect to shared memory to access metadata. The file system of this technical solution is a user-mode file system, which allocates shared memory to store metadata. The most frequent operations of the database are reading and writing data files and log files. These operations are directly connected to the shared memory to minimize the overhead.

[0146] 4. Metadata modification is synchronously replicated. Metadata changes will record the changed parts, that is, log information. Metadata modification on one node can only succeed after all other nodes receive the log and apply it to memory. Therefore, when the operation of adding, deleting, or modifying a directory or file is successfully returned to the storage end, it must be effective on all nodes in the cluster.

[0147] When modifying user data, the database itself will have relevant concurrency control to avoid write corruption, and the file system does not need to perform additional concurrency control.

[0148] As for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.

[0149] Reference Figure 3 , showing a structural block diagram of a data management device provided by an embodiment of the present application;

[0150] A data management device, the device involves a storage end and a client end, wherein the storage end is used to process metadata, the processing includes update processing and read and write processing, and the device includes:

[0151] A first sending module 310 is used for the storage end to receive a connection request sent by the client, and determine a key value corresponding to a shared memory according to the connection request, and send the key value to the client, wherein the shared memory is generated by initialization processing of the storage end;

[0152] The first allocation module 320 is used to determine the metadata to be updated based on the metadata update request when the storage end receives the metadata update request sent by the client, and allocate the metadata to be updated to the shared memory, wherein the metadata to be updated includes directories, files and file partition tables.

[0153] In an embodiment of the present invention, the first sending module 310 includes:

[0154] The first acquisition submodule is used to determine the target shared disk according to preset configuration information.

[0155] A first processing submodule, configured to, when it is detected that the target shared disk is not formatted, cause the storage end to format the target shared disk according to the preset configuration information, and initialize the target shared disk to obtain BOOT information;

[0156] A first determining submodule, used for the storage end to determine the number information according to the BOOT information;

[0157] A first construction submodule is used for the storage end to construct a corresponding number of to-be-initialized shared memories according to the number of the number information, wherein at least one of the to-be-initialized shared memories is used to store manager information;

[0158] A second determination submodule is used for the storage end to determine the disk location corresponding to each shared memory to be initialized according to the manager information;

[0159] The marking submodule is used for the storage end to add initial metadata to the corresponding shared memory to be initialized in the target disk according to the disk position, and mark the initialized shared memory as the shared memory after the initial metadata is added.

[0160] In one embodiment of the present invention, the first allocation module 320 includes:

[0161] A third determination submodule, configured for the storage end to determine whether there is a first target data block corresponding to the metadata to be updated according to the metadata to be updated;

[0162] a fourth determination submodule, configured to, when the first target data block does not exist, cause the storage end to determine whether there is an unused data block in the current shared memory;

[0163] A second construction submodule, configured to generate, by the storage end, a request for constructing a shared memory when the current shared memory does not contain the unused data block;

[0164] A third construction submodule is used for the storage end to construct a target shared memory according to the construction shared memory request;

[0165] The fourth determination submodule is used for the storage end to determine a second target data block in the target shared memory for storing the metadata to be updated, and write the metadata to be updated into the second target data block.

[0166] Reference Figure 4 , showing a structural block diagram of a data management device provided by an embodiment of the present application;

[0167] A data management method, the method involving a storage end and a client, wherein the storage end is used to process metadata, the processing including update processing and read-write processing, and the method comprising:

[0168] A second sending module 410 is used for, when detecting that the database instance is started, the client generates a connection request and sends the connection request to the storage end;

[0169] A first connection module 420, configured to connect the client to the shared memory according to the key value when the client receives the key value sent by the storage end;

[0170] A third sending module 430 is used for, when the client has a task to be updated, the client generating a metadata update request according to the metadata to be updated in the task to be updated, and sending the metadata update request to the storage end;

[0171] The first reading module 440 is configured to, when the client has a business data read / write request, enable the client to read the target file according to the business data read / write request and the target metadata in the shared memory.

[0172] In one embodiment of the present invention, the first reading module 440 includes:

[0173] A fifth determination submodule, configured for the client to determine the target metadata according to the business data read and write request;

[0174] A sixth determination submodule, configured for the client to determine a target disk location according to the target metadata;

[0175] The second acquisition submodule is used for the client to acquire the target file according to the target disk location.

[0176] In one embodiment of the present invention, the fifth determining submodule includes:

[0177] An acquisition unit, configured for the client to acquire all metadata in the shared memory according to the business data read and write request;

[0178] A first determining unit, configured for the client to determine all data blocks corresponding to all metadata according to all metadata;

[0179] A second determining unit is configured to, when all the data blocks are not in the existing shared memory, query the target manager information of the existing shared memory by the client, and determine whether there is a new shared memory to be loaded through the target manager information;

[0180] A generating unit, configured to, when the new shared memory needs to be loaded, cause the client to obtain the slot information and the target key value in the target manager information to generate the new shared memory;

[0181] A third determining unit, configured for the client to determine a third target data block according to the new shared memory;

[0182] A fourth determining unit is used for the client to determine the target metadata according to the third target data block.

[0183] Reference Figure 5 , showing a computer device of a data management method of the present invention, which may specifically include the following:

[0184] The computer device 12 is in the form of a general-purpose computing device, and the components of the computer device 12 may include but are not limited to: one or more processors or processing units 16, a system memory 28, and a bus 18 connecting different system components (including the system memory 28 and the processing unit 16).

[0185] The bus 18 represents one or more of several types of bus 18 structures, including a memory bus 18 or memory controller, a peripheral bus 18, an accelerated graphics port, a processor or a local bus 18 using any of a variety of bus 18 architectures. These architectures include, by way of example, but are not limited to, an Industry Standard Architecture (ISA) bus 18, a Micro Channel Architecture (MAC) bus 18, an Enhanced ISA bus 18, an Audio Video Electronics Standards Association (VESA) local bus 18, and a Peripheral Component Interconnect (PCI) bus 18.

[0186] The computer device 12 typically includes a variety of computer system readable media. These media can be any available media that can be accessed by the computer device 12, including volatile and non-volatile media, removable and non-removable media.

[0187] System memory 28 may include computer system readable media in the form of volatile memory, such as random access memory (RAM) 30 and / or cache memory 32. Computer device 12 may further include other removable / non-removable, volatile / non-volatile computer system storage media. By way of example only, storage system 34 may be used to read and write to non-removable, non-volatile magnetic media (commonly referred to as a "hard drive"). Although Figure 5 Not shown, a disk drive for reading and writing to a removable non-volatile disk (such as a "floppy disk"), and an optical disk drive for reading and writing to a removable non-volatile optical disk (such as a CD-ROM, DVD-ROM or other optical medium) may be provided. In these cases, each drive may be connected to the bus 18 via one or more data medium interfaces. The memory may include at least one program product having a set (e.g., at least one) of program modules 42, which are configured to perform the functions of various embodiments of the present invention.

[0188] A program / utility 40 having a set (at least one) of program modules 42 may be stored in, for example, a memory, such program modules 42 including, but not limited to, an operating system, one or more application programs, other program modules 42, and program data, each of which or some combination may include an implementation of a network environment. The program modules 42 generally perform the functions and / or methods of the embodiments described herein.

[0189] The computer device 12 may also communicate with one or more external devices 14 (e.g., keyboards, pointing devices, displays 24, cameras, etc.), one or more devices that enable a user to interact with the computer device 12, and / or any device that enables the computer device 12 to communicate with one or more other computing devices (e.g., network cards, modems, etc.). Such communication may be performed via an input / output (I / O) interface 22. Furthermore, the computer device 12 may also communicate with one or more networks (e.g., local area networks (LANs)), wide area networks (WANs), and / or public networks (e.g., the Internet) via a network adapter 20. As shown, the network adapter 20 communicates with the other modules of the computer device 12 via the bus 18. It should be understood that although Figure 5 Not shown, other hardware and / or software modules may be used in conjunction with the computer device 12, including but not limited to: microcode, device drivers, redundant processing units 16, external disk drive arrays, RAID systems, tape drives, and data backup storage systems 34, etc.

[0190] The processing unit 16 executes various functional applications and data processing by running programs stored in the system memory 28, such as implementing a data management method provided by an embodiment of the present invention.

[0191] That is, when the processing unit 16 executes the program, the following is achieved: the storage end receives the connection request sent by the client, determines the key value corresponding to the shared memory according to the connection request, and sends the key value to the client, wherein the shared memory is generated by the initialization processing of the storage end; when the storage end receives the metadata update request sent by the client, the storage end determines the metadata to be updated according to the metadata update request, and allocates the metadata to be updated to the shared memory, wherein the metadata to be updated includes directories, files, and file partition tables.

[0192] In an embodiment of the present invention, the present invention further provides a computer-readable storage medium on which a computer program is stored, and when the program is executed by a processor, a data management method provided in all embodiments of the present application is implemented:

[0193] That is, when the program is executed by the processor, it is implemented as follows: the storage end receives the connection request sent by the client, determines the key value corresponding to the shared memory according to the connection request, and sends the key value to the client, wherein the shared memory is generated by the initialization processing of the storage end; when the storage end receives the metadata update request sent by the client, the storage end determines the metadata to be updated according to the metadata update request, and allocates the metadata to be updated to the shared memory, wherein the metadata to be updated includes directories, files, and file partition tables.

[0194] Any combination of one or more computer-readable media may be used. A computer-readable medium may be a computer readable signal medium or a computer-readable storage medium. A computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media (a non-exhaustive list) include: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In this document, a computer-readable storage medium may be any tangible medium containing or storing a program that may be used by or in conjunction with an instruction execution system, device or device.

[0195] Computer-readable signal media may include a data signal propagated in baseband or as part of a carrier wave, which carries a computer-readable program code. Such propagated data signals may take a variety of forms, including, but not limited to, electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than a computer-readable storage medium, which may send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device.

[0196] The computer program code for performing the operation of the present invention can be written in one or more programming languages ​​or a combination thereof, including object-oriented programming languages, such as Java, Smalltalk, C++, and conventional procedural programming languages, such as "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as an independent software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer can be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or can be connected to an external computer (for example, using an Internet service provider to connect through the Internet). The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same and similar parts between the various embodiments can be referred to each other.

[0197] Although the preferred embodiments of the present application have been described, those skilled in the art may make additional changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the embodiments of the present application.

[0198] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or terminal device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or terminal device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or terminal device including the elements.

[0199] The above is a detailed introduction to a data management method, device, equipment and storage medium provided by the present application. Specific examples are used in this article to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea. At the same time, for general technical personnel in this field, according to the idea of ​​the present application, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.

Claims

1. A data management method, characterized in that: The method involves a storage end and a client end, wherein the storage end is used for processing metadata, the processing including update processing and read-write processing, and the method includes: The storage end receives a connection request sent by the client, and determines a key value corresponding to a shared memory according to the connection request, and sends the key value to the client, wherein the shared memory is generated by initialization processing by the storage end; a target shared disk is determined according to preset configuration information; when it is detected that the target shared disk is not formatted, the storage end formats the target shared disk according to the preset configuration information, and initializes the target shared disk to obtain BOOT information; the storage end determines number information according to the BOOT information; the storage end constructs a corresponding number of shared memories to be initialized according to the number information, wherein at least one shared memory to be initialized is used to store manager information; the storage end determines a disk position corresponding to each shared memory to be initialized according to the manager information; the storage end adds initial metadata to the corresponding shared memory to be initialized in the target disk according to the disk position, and marks the initialized shared memory as the shared memory after the initial metadata is added; When the storage end receives the metadata update request sent by the client, the storage end determines the metadata to be updated according to the metadata update request, and allocates the metadata to be updated to the shared memory, wherein the metadata to be updated includes directories, files, and file partition tables; When it is detected that the database instance is started, the client generates a connection request and sends the connection request to the storage end; when the client receives the key value sent by the storage end, the client connects to the shared memory based on the key value; when the client has a task to be updated, the client generates a metadata update request based on the metadata to be updated in the task to be updated, and sends the metadata update request to the storage end; when the client has a business data read and write request, the client reads the target file based on the business data read and write request and the target metadata in the shared memory.

2. The method according to claim 1, characterized in that The step of determining the metadata to be updated according to the metadata update request, and allocating the metadata to be updated to the shared memory, wherein the metadata to be updated includes directories, files, and file partition tables, comprises: The storage end determines whether there is a first target data block corresponding to the metadata to be updated according to the metadata to be updated; When the first target data block does not exist, the storage end determines whether there is an unused data block in the current shared memory; When the current shared memory does not contain the unused data block, the storage end generates a request to construct a shared memory; The storage end constructs a target shared memory according to the shared memory construction request; The storage end determines a second target data block in the target shared memory for storing the metadata to be updated, and writes the metadata to be updated into the second target data block.

3. The method according to claim 1, characterized in that The step of reading the target file according to the business data read / write request and the target metadata in the shared memory includes: The client determines the target metadata according to the business data read and write request; The client determines the target disk location according to the target metadata; The client obtains the target file according to the target disk location.

4. The method according to claim 3, characterized in that The step of determining the target metadata according to the business data read / write request comprises: The client obtains all metadata in the shared memory according to the business data read and write request; The client determines all data blocks corresponding to all metadata according to all metadata; When all the data blocks are not in the existing shared memory, the client queries the target manager information of the existing shared memory, and determines whether there is a new shared memory to be loaded through the target manager information; When the new shared memory needs to be loaded, the client obtains the slot information and the target key value in the target manager information to generate the new shared memory; The client determines a third target data block according to the new shared memory; The client determines the target metadata according to the third target data block.

5. A data management device, characterized in that: The device involves a storage end and a client end, wherein the storage end is used for processing metadata, the processing including update processing and read-write processing, and the device includes: The first sending module is used for the storage end to receive the connection request sent by the client, and determine the key value corresponding to the shared memory according to the connection request, and send the key value to the client, wherein the shared memory is generated by the initialization processing of the storage end; determine the target shared disk according to the preset configuration information; when it is detected that the target shared disk is not formatted, the storage end formats the target shared disk according to the preset configuration information, and initializes the target shared disk to obtain BOOT information; the storage end determines the number information according to the BOOT information; the storage end constructs the corresponding number of shared memories to be initialized according to the number information, wherein at least one shared memory to be initialized is used to store manager information; the storage end determines the disk position corresponding to each shared memory to be initialized according to the manager information; the storage end adds initial metadata to the corresponding shared memory to be initialized in the target disk according to the disk position, and marks the initialized shared memory as the shared memory after the initial metadata is added; A first allocation module, configured to, when the storage end receives a metadata update request sent by the client, determine the metadata to be updated according to the metadata update request, and allocate the metadata to be updated to the shared memory, wherein the metadata to be updated includes directories, files, and file partition tables; The second sending module is used for, when it is detected that the database instance is started, the client generates a connection request and sends the connection request to the storage end; the first connection module is used for, when the client receives the key value sent by the storage end, the client connects to the shared memory according to the key value; the third sending module is used for, when the client has a task to be updated, the client generates a metadata update request according to the metadata to be updated in the task to be updated, and sends the metadata update request to the storage end; the first reading module is used for, when the client has a business data read and write request, the client reads the target file according to the business data read and write request and the target metadata in the shared memory.

6. A computer device, characterized in that: The method comprises a processor, a memory, and a computer program stored in the memory and capable of running on the processor, wherein the computer program implements the method according to any one of claims 1 to 4 when executed by the processor.

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

Citation Information

Patent Citations

  • Method for managing and allocating resource in parallel file system

    CN101567003A

  • Method for optimizing performance of disk database by memory database technology

    CN102945251A

  • Dynamic data storage method

    CN102117340A

  • Distributed file system and data management method

    CN111796767A

  • Data processing method and device and storage medium

    CN112148693A