[go: up one dir, main page]

CN118051642A - Data storage method and system of database system - Google Patents

Data storage method and system of database system Download PDF

Info

Publication number
CN118051642A
CN118051642A CN202211397508.0A CN202211397508A CN118051642A CN 118051642 A CN118051642 A CN 118051642A CN 202211397508 A CN202211397508 A CN 202211397508A CN 118051642 A CN118051642 A CN 118051642A
Authority
CN
China
Prior art keywords
data
physical
table space
file
physical file
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202211397508.0A
Other languages
Chinese (zh)
Inventor
许友松
苏斌
张志强
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Huawei Cloud Computing Technologies Co Ltd
Original Assignee
Huawei Cloud Computing Technologies Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Huawei Cloud Computing Technologies Co Ltd filed Critical Huawei Cloud Computing Technologies Co Ltd
Priority to CN202211397508.0A priority Critical patent/CN118051642A/en
Publication of CN118051642A publication Critical patent/CN118051642A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/901Indexing; Data structures therefor; Storage structures
    • G06F16/9017Indexing; Data structures therefor; Storage structures using directory or table look-up
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/901Indexing; Data structures therefor; Storage structures

Landscapes

  • Engineering & Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The embodiment of the application provides a data storage method and a data storage system of a database system, which relate to the technical field of databases, and comprise the following steps: the database system can be provided with at least two data catalogues, and the data in the same table space of the database system are stored in different data catalogues, so that the data in the same table can be stored in different storage paths.

Description

数据库系统的数据存储方法及系统Data storage method and system of database system

技术领域Technical Field

本申请实施例涉及数据库技术领域,尤其涉及一种数据库系统的数据存储方法及系统。The embodiments of the present application relate to the field of database technology, and in particular, to a data storage method and system for a database system.

背景技术Background technique

数据库可实现数据的存储,目前的数据库系统的存储方案,可支持将多个数据表的数据存储到不同的存储路径,例如数据库系统内部创建的表可存储在指定的存储路径,以及数据库系统还可以使用外表。The database can store data. The current storage solution of the database system can support storing data from multiple tables in different storage paths. For example, the tables created inside the database system can be stored in the specified storage path, and the database system can also use external tables.

但是,目前的数据库系统的数据存储方案无法对单个表内的数据,实现不同存储路径的存储。However, the current data storage solution of the database system cannot implement storage of different storage paths for the data in a single table.

发明内容Summary of the invention

为了解决上述技术问题,本申请提供一种数据库系统的数据存储方法及系统。在该方法中,可将数据库系统的同一张表的数据存储在不同的数据目录内,以实现同一张表内的数据在不同存储路径的存储。In order to solve the above technical problems, the present application provides a data storage method and system for a database system. In this method, data of the same table of the database system can be stored in different data directories to achieve storage of data in the same table in different storage paths.

在一种可能的实施方式中,本申请提供一种数据库系统的数据存储方法。所述数据库系统的数据目录包括:第一数据目录和至少一个第二数据目录。该方法包括:基于第一写入请求,将第一数据写入至所述第二数据目录内的第二物理文件;其中,所述第一写入请求包括请求向第一表空间写入的第一数据;所述第二物理文件与所述第一表空间相关联;所述第一表空间还与所述第一数据目录内的第一物理文件相关联;所述第一物理文件包括所述第一表空间的部分数据。In a possible implementation, the present application provides a data storage method for a database system. The data directory of the database system includes: a first data directory and at least one second data directory. The method includes: based on a first write request, writing first data to a second physical file in the second data directory; wherein the first write request includes a request to write first data to a first tablespace; the second physical file is associated with the first tablespace; the first tablespace is also associated with a first physical file in the first data directory; the first physical file includes part of the data of the first tablespace.

其中,数据目录为数据库系统的文件系统目录。The data directory is the file system directory of the database system.

例如,第一数据目录为数据库系统的默认数据目录,第二数据目录为数据库系统扩展的数据目录,这里不做限制。另外,第二数据目录的数量可以是一个或多个。For example, the first data directory is a default data directory of the database system, and the second data directory is an extended data directory of the database system, which is not limited here. In addition, the number of the second data directories can be one or more.

其中,第一表空间可以是在对数据库设置有第二数据目录之前就已经创建的表空间,那么第一表空间可看做“旧表”,如果是对数据库设置有第二数据目录之后,再创建的表空间则可以看做“新表”。Among them, the first table space can be a table space created before the second data directory is set for the database, so the first table space can be regarded as an "old table". If the table space is created after the second data directory is set for the database, it can be regarded as a "new table".

第一表空间为“旧表”,第一数据目录中包括与第一表空间关联的第一物理文件,且第一物理文件包括该第一表空间的部分数据,该部分数据可包括至少一个数据页。The first table space is an "old table", the first data directory includes a first physical file associated with the first table space, and the first physical file includes partial data of the first table space, and the partial data may include at least one data page.

在数据库系统配置有第二数据目录后,在向“旧表”写入数据时,具体为这里的第一写入请求,该第一写入请求为数据库的数据写入请求,该第一写入请求包括请求向第一表空间写入的第一数据。那么该方法可将该第一数据写入至第二数据目录(例如一个第二数据目录)内与该第一表空间关联的第二物理文件。After the database system is configured with a second data directory, when writing data to the "old table", specifically the first write request here, the first write request is a data write request of the database, and the first write request includes a request to write first data to the first table space. Then the method can write the first data to the second physical file associated with the first table space in the second data directory (for example, a second data directory).

这样,本申请实施例的方法可在向数据库存储数据时,将同一表空间的数据存储在不同的数据目录内,以实现同一张表内的数据在不同存储路径的存储。In this way, the method of the embodiment of the present application can store data in the same table space in different data directories when storing data in the database, so as to achieve the storage of data in the same table in different storage paths.

在一种可能的实施方式中,所述基于第一写入请求,将第一数据写入至所述第二数据目录内的第二物理文件,包括:基于第一写入请求,在确定所述第二数据目录内不包括与所述第一表空间关联的第二物理文件的情况下,在所述第二数据目录内创建与所述第一表空间关联的第二物理文件;将第一数据写入至所述第二物理文件。In a possible implementation, writing the first data to the second physical file in the second data directory based on the first write request includes: based on the first write request, when it is determined that the second data directory does not include the second physical file associated with the first tablespace, creating a second physical file associated with the first tablespace in the second data directory; and writing the first data to the second physical file.

其中,在第二数据目录中不包括与第一表空间管理的物理文件时,则说明第二数据目录还未写入过该第一表空间的数据,则该方法可基于第一写入请求,来在第二数据目录内创建一个空的第二物理文件,并且使该第二物理文件与该第一表空间关联,这样,第一表空间不仅与第一数据目录内的第一物理文件关联,还与第二数据目录内的第二物理文件关联,从而可以将第一表空间的数据写入到不同的数据目录内的物理文件中,以实现同一表空间的数据在不同数据目录的分布式存储。Among them, when the second data directory does not include physical files managed by the first tablespace, it means that the second data directory has not written the data of the first tablespace. Then, the method can create an empty second physical file in the second data directory based on the first write request, and associate the second physical file with the first tablespace. In this way, the first tablespace is associated not only with the first physical file in the first data directory, but also with the second physical file in the second data directory, so that the data of the first tablespace can be written to physical files in different data directories to realize distributed storage of data of the same tablespace in different data directories.

在一种可能的实施方式中,所述第一物理文件包括所述第一表空间的至少一个数据页的数据,所述第二物理文件包括所述第一表空间的至少一个数据页的数据。In a possible implementation, the first physical file includes data of at least one data page of the first table space, and the second physical file includes data of at least one data page of the first table space.

其中,任意一个表空间在逻辑上可由多个数据页组成,那么本申请的方法在将同一表空间的数据存储至不同的数据目录时,存储的数据的粒度为数据页级别的,也就是说,本申请可将第一表空间的至少一个数据页的数据存储至第一数据目录内的第一物理文件,还可以将第一表空间的另外至少一个数据页的数据存储在第二数据目录的第二物理文件内,能够实现同一表空间的数据页粒度的跨目录存储。Among them, any table space can be logically composed of multiple data pages. Then, when the method of the present application stores data from the same table space in different data directories, the granularity of the stored data is at the data page level. That is to say, the present application can store data of at least one data page of the first table space in the first physical file in the first data directory, and can also store data of another at least one data page of the first table space in the second physical file of the second data directory, thereby realizing cross-directory storage of data page granularity of the same table space.

在一种可能的实施方式中,所述将第一数据写入至所述第二数据目录内的第二物理文件之后,所述方法还包括:基于对所述第一表空间的第一访问请求,依据所述第一物理文件的文件大小、所述第二物理文件的文件大小、所述第一物理文件与所述第二物理文件之间的创建先后顺序,将对所述第一表空间的第一访问地址,映射至第三物理文件中的第二访问地址,其中,所述第三物理文件为所述第一物理文件或所述第二物理文件,其中,所述第一访问请求包括所述第一访问地址;按照所述第二访问地址访问所述第一表空间的数据。In a possible implementation, after writing the first data to the second physical file in the second data directory, the method further includes: based on a first access request to the first tablespace, according to the file size of the first physical file, the file size of the second physical file, and the order of creation of the first physical file and the second physical file, mapping the first access address of the first tablespace to the second access address in a third physical file, wherein the third physical file is the first physical file or the second physical file, and wherein the first access request includes the first access address; accessing the data of the first tablespace according to the second access address.

其中,第一访问请求可以包括但不限于:删除数据请求、查询数据请求、修改数据请求。The first access request may include but is not limited to: a data deletion request, a data query request, and a data modification request.

由于第一表空间的数据存储在至少两个数据目录内,这里为第一数据目录和第二数据目录,那么在业务对第一表空间请求访问时,为了能够准确地定位所访问的数据在哪个数据目录的哪个物理文件,以及在该物理文件中对应的访问地址,在对第一表空间的第一访问请求进行处理时,可依据与第一表空间关联的第一物理文件以及第二物理文件各自的文件大小,以及第一物理文件和第二物理文件之间的创建先后顺序,来将第一访问请求对应的第一访问地址映射至需要访问的物理文件(例如第一物理文件或第二物理文件)中的第二访问地址。Since the data of the first tablespace is stored in at least two data directories, namely the first data directory and the second data directory, when a business requests access to the first tablespace, in order to accurately locate which physical file in which data directory the accessed data is located in, and the corresponding access address in the physical file, when processing the first access request to the first tablespace, the first access address corresponding to the first access request can be mapped to the second access address in the physical file to be accessed (for example, the first physical file or the second physical file) based on the respective file sizes of the first physical file and the second physical file associated with the first tablespace, and the order in which the first physical file and the second physical file are created.

其中,第一表空间内的数据存储在第一物理文件和第二物理文件,而在第二物理文件创建之后,在向第一表空间写入的数据都可以存储至第二物理文件,而第一物理文件在第二物理文件之前创建,且表空间内的一个数据页可对应有物理文件对应的磁盘的一个磁盘块,以及表空间内的数据是按照数据页的创建顺序依次进行数据写入的。因此,该方法可上述两个物理文件的大小以及两个物理文件之间的创建先后顺序,来确定第一表空间的前多少数据页的数据存储在第一物理文件,后多少数据页的数据存储在第二物理文件,从而基于第一访问请求所需要访问的数据页(对应于第一访问地址),来确定本次需要访问的物理文件以及在本次需要访问的物理文件中的第二访问地址(例如逻辑地址),从而按照该第二访问地址来向该物理文件对应的磁盘中的相应物理地址进行第一表空间的数据访问。Among them, the data in the first table space is stored in the first physical file and the second physical file, and after the second physical file is created, the data written to the first table space can be stored in the second physical file, and the first physical file is created before the second physical file, and a data page in the table space can correspond to a disk block of the disk corresponding to the physical file, and the data in the table space is written in sequence according to the order in which the data pages are created. Therefore, the method can determine how many of the first data pages of the first table space are stored in the first physical file and how many of the last data pages are stored in the second physical file based on the sizes of the above two physical files and the order in which the two physical files are created, so as to determine the physical file to be accessed this time and the second access address (e.g., logical address) in the physical file to be accessed this time based on the data page to be accessed by the first access request (corresponding to the first access address), so as to access the data of the first table space to the corresponding physical address in the disk corresponding to the physical file according to the second access address.

示例性的,该第一访问请求可以是在将第一数据写入到第二物理文件之后,且未重启数据库系统而触发的请求,那么上述第一物理文件和第二物理文件的文件大小以及两个文件之间的创建先后顺序的信息都可以是在接收到第一访问请求之后即时获取的。Exemplarily, the first access request may be a request triggered after the first data is written to the second physical file and without restarting the database system. Then, the file sizes of the first physical file and the second physical file and the information on the creation order of the two files may be obtained immediately after receiving the first access request.

示例性的,该第一访问请求也可以是在将第一数据写入到第二物理文件之后,数据库系统经过了重启,那么在每次数据库重启之后,本申请的方法都可以对关联有不同数据目录的表空间,来获取该表空间对应的至少两个物理文件的文件大小以及文件的创建先后顺序的信息并进行记录,以在接收到对关联有至少两个数据目录的表空间的访问请求时,来利用记录的上述信息,来对需要访问的数据的地址进行准确地定位。Exemplarily, the first access request may also be after the database system is restarted after the first data is written to the second physical file. Then, after each database restart, the method of the present application can obtain the file size and file creation order of at least two physical files corresponding to the table space associated with different data directories and record them, so as to use the recorded information to accurately locate the address of the data to be accessed when receiving an access request to the table space associated with at least two data directories.

这样,本申请实施例可对关联有至少两个数据目录内的至少两个物理文件的表空间进行数据访问时,准确地定位所访问的数据的地址,以实现数据库系统内数据页进行分布式存储的表空间的地址映射。In this way, the embodiment of the present application can accurately locate the address of the accessed data when accessing data in a table space associated with at least two physical files in at least two data directories, so as to realize address mapping of the table space for distributed storage of data pages in the database system.

在一种可能的实施方式中,所述方法还包括:在所述数据库系统重启时,确定所述第一数据目录内和所述至少一个第二数据目录内各自的物理文件中,与同一第二表空间关联的至少两个第四物理文件;记录第一信息,其中,所述第一信息包括:与所述第二表空间关联的所述至少两个第四物理文件中每个物理文件的文件大小、以及所述至少两个第四物理文件中不同所述第四物理文件之间的创建先后顺序。In a possible implementation, the method further includes: when the database system is restarted, determining at least two fourth physical files associated with the same second table space in the respective physical files in the first data directory and in the at least one second data directory; and recording first information, wherein the first information includes: the file size of each physical file in the at least two fourth physical files associated with the second table space, and the creation order between different fourth physical files in the at least two fourth physical files.

其中,第二表空间可以包括上述第一表空间。第二表空间指代在不同数据目录内关联有至少两个物理文件的表空间。The second table space may include the first table space. The second table space refers to a table space associated with at least two physical files in different data directories.

示例性的,在第二表空间包括第一表空间时,上述至少两个第四物理文件可包括上述第一物理文件和第二物理文件。Exemplarily, when the second tablespace includes the first tablespace, the at least two fourth physical files may include the first physical file and the second physical file.

本实施方式可确保每次数据库重启之后,数据库能够支持对关联了多个物理文件的表空间进行有效地数据访问的需求。This implementation can ensure that after each database restart, the database can support the demand for effective data access to a table space associated with multiple physical files.

在一种可能的实施方式中,所述记录第一信息之后,所述方法还包括:基于对所述第二表空间的第二访问请求,依据对所述第二表空间记录的所述第一信息,在与所述第二表空间关联的至少一个所述第四物理文件中,访问所述第二表空间的数据。In a possible implementation, after recording the first information, the method further includes: based on a second access request to the second tablespace, accessing data of the second tablespace in at least one of the fourth physical files associated with the second tablespace according to the first information recorded for the second tablespace.

本实施方式的具体实现原理,与上述对第一表空间的第一访问请求进行处理的实施方式的实现原理及效果类似,这里不再赘述。The specific implementation principle of this implementation mode is similar to the implementation principle and effect of the above-mentioned implementation mode of processing the first access request to the first table space, and will not be repeated here.

在一种可能的实施方式中,所述方法还包括:基于第二写入请求,在所述数据库系统中创建第三表空间,其中,所述第二写入请求包括请求向第三表空间写入的第二数据;在所述第二数据目录内创建与所述第三表空间关联的第五物理文件;将所述第二数据写入至所述第五物理文件。In a possible implementation, the method further includes: creating a third tablespace in the database system based on a second write request, wherein the second write request includes a request for second data to be written to the third tablespace; creating a fifth physical file associated with the third tablespace in the second data directory; and writing the second data to the fifth physical file.

其中,这里的第三表空间可称为“新表”,该第三表空间可为在对数据库系统设置了第二数据目录之后,业务请求新建的表空间,以及请求向该新建的表空间中写入数据。The third table space here may be referred to as a "new table", and the third table space may be a newly created table space requested by a business after the second data directory is set for the database system, and a request is made to write data into the newly created table space.

示例性的,第三表空间与第二表空间、第一表空间可不同。Exemplarily, the third tablespace may be different from the second tablespace and the first tablespace.

可选地,在本实施方式中,该第三表空间可只关联有第二数据目录内的第五物理文件,而不关联有第一数据目录内的任何物理文件,使得第三表空间的数据只存储在第二数据目录内。Optionally, in this embodiment, the third table space may be associated only with the fifth physical file in the second data directory, but not with any physical file in the first data directory, so that the data in the third table space is only stored in the second data directory.

在一种可能的实施方式中,所述方法还包括:确定所述第一数据目录内和所述至少一个第二数据目录内各自的物理文件中,与同一第四表空间关联的至少两个第六物理文件;基于所述至少两个第六物理文件中不同所述第六物理文件之间的创建先后顺序,按照创建时间从早到晚的顺序,将所述至少两个第六物理文件内的数据进行连接,以获取所述第四表空间的表数据;将所述第四表空间的表数据进行备份。In a possible implementation, the method further includes: determining at least two sixth physical files associated with the same fourth table space in the respective physical files in the first data directory and the at least one second data directory; connecting the data in the at least two sixth physical files in order of creation time from earliest to latest based on the creation order between different sixth physical files in the at least two sixth physical files to obtain the table data of the fourth table space; and backing up the table data of the fourth table space.

示例性的,这里的第四表空间用于指代在不同数据目录内关联有至少两个物理文件的表空间。例如第四表空间可包括上述第二表空间,或者与第二表空间相同,这里不做限制。同理,第六物理文件可与第四物理文件相同。Exemplarily, the fourth tablespace here refers to a tablespace associated with at least two physical files in different data directories. For example, the fourth tablespace may include the second tablespace, or be the same as the second tablespace, which is not limited here. Similarly, the sixth physical file may be the same as the fourth physical file.

在对在不同数据目录内均存储有数据的表空间的数据进行备份时,本实施方式可按照该表空间在不同数据目录关联的至少两个第六物理文件之间的创建先后顺序(这里为从早到晚),来对该至少两个第六物理文件的数据进行连接,以获取该表空间的表数据,并对其进行备份。When backing up data in a table space that stores data in different data directories, this embodiment can connect the data of at least two sixth physical files associated with the table space in different data directories according to the creation order (here from early to late) between the at least two sixth physical files to obtain the table data of the table space and back it up.

例如数据库系统的数据目录包括数据目录1和数据目录2,其中,数据目录1包括与表1关联的物理文件a,数据目录2包括与表1关联的物理文件b,数据目录2在数据路1之后创建,使得物理文件b在物理文件a之后创建,那么在对表1的数据进行备份时,该方法可从物理文件a读取全部的表数据,以及从物理文件b读取全部的表数据,并将从物理文件b读取到的表数据的数据开始位置,连接到从物理文件a读取到的表数据的数据结束位置,从而获取到表1的完整的数据,并对获取到的表1的完整的数据进行备份。For example, the data directory of the database system includes data directory 1 and data directory 2, wherein data directory 1 includes physical file a associated with table 1, data directory 2 includes physical file b associated with table 1, and data directory 2 is created after data directory 1, so that physical file b is created after physical file a. Then, when backing up the data of table 1, the method can read all the table data from physical file a and all the table data from physical file b, and connect the data start position of the table data read from physical file b to the data end position of the table data read from physical file a, so as to obtain the complete data of table 1 and back up the obtained complete data of table 1.

这样,对于在不同数据目录内存储表数据的同一表空间,本申请也可以实现对该表空间的数据的完整且准确的备份。In this way, for the same table space storing table data in different data directories, the present application can also implement complete and accurate backup of the data in the table space.

在一种可能的实施方式中,所述第一物理文件在所述第二物理文件之前创建。In a possible implementation manner, the first physical file is created before the second physical file.

在一种可能的实施方式中,所述数据库系统的多个数据目录分别位于不同的文件系统。In a possible implementation, the multiple data directories of the database system are located in different file systems respectively.

其中,这里的多个数据目录包括第一数据目录和至少一个第二数据目录。The multiple data directories here include a first data directory and at least one second data directory.

这样,可使数据库的同一表数据存储在不同的文件系统,以满足数据的不同存储需求。In this way, data in the same table of the database can be stored in different file systems to meet different data storage requirements.

在一种可能的实施方式中,所述数据库系统对应的多个所述文件系统对应的磁盘的磁盘类型不同。In a possible implementation manner, the disks corresponding to the multiple file systems corresponding to the database system are of different disk types.

其中,多个文件系统包括第一数据目录以及至少一个第二数据目录所各自对应的文件系统。The multiple file systems include file systems corresponding to the first data directory and at least one second data directory.

这样,数据库系统可使用不同类型的磁盘来实现同一表空间的数据存储,以利用不同类型磁盘的特性(例如速度大、容量大等),来实现数据的存储。In this way, the database system can use different types of disks to implement data storage in the same table space, so as to utilize the characteristics of different types of disks (such as high speed, large capacity, etc.) to implement data storage.

在一种可能的实施方式中,本申请提供一种数据库系统的数据存储系统。所述数据库系统的数据目录包括:第一数据目录和至少一个第二数据目录,所述数据存储系统包括:第一写入模块,用于基于第一写入请求,将第一数据写入至所述第二数据目录内的第二物理文件;其中,所述第一写入请求包括请求向第一表空间写入的第一数据;所述第二物理文件与所述第一表空间相关联;所述第一表空间还与所述第一数据目录内的第一物理文件相关联;所述第一物理文件包括所述第一表空间的部分数据。In a possible implementation, the present application provides a data storage system for a database system. The data directory of the database system includes: a first data directory and at least one second data directory, and the data storage system includes: a first writing module, which is used to write first data to a second physical file in the second data directory based on a first writing request; wherein the first writing request includes a request to write first data to a first table space; the second physical file is associated with the first table space; the first table space is also associated with a first physical file in the first data directory; the first physical file includes part of the data of the first table space.

在一种可能的实施方式中,所述第一写入模块,具体用于:基于第一写入请求,在确定所述第二数据目录内不包括与所述第一表空间关联的第二物理文件的情况下,在所述第二数据目录内创建与所述第一表空间关联的第二物理文件;将第一数据写入至所述第二物理文件。In a possible implementation, the first write module is specifically used to: based on the first write request, when it is determined that the second data directory does not include the second physical file associated with the first table space, create a second physical file associated with the first table space in the second data directory; and write the first data to the second physical file.

在一种可能的实施方式中,所述第一物理文件包括所述第一表空间的至少一个数据页的数据,所述第二物理文件包括所述第一表空间的至少一个数据页的数据。In a possible implementation, the first physical file includes data of at least one data page of the first table space, and the second physical file includes data of at least one data page of the first table space.

在一种可能的实施方式中,所述数据存储系统还包括:映射模块,用于基于对所述第一表空间的第一访问请求,依据所述第一物理文件的文件大小、所述第二物理文件的文件大小、所述第一物理文件与所述第二物理文件之间的创建先后顺序,将对所述第一表空间的第一访问地址,映射至第三物理文件中的第二访问地址,其中,所述第三物理文件为所述第一物理文件或所述第二物理文件,其中,所述第一访问请求包括所述第一访问地址;第一访问模块,用于按照所述第二访问地址访问所述第一表空间的数据。In a possible implementation, the data storage system further includes: a mapping module, used to map a first access address to the first table space to a second access address in a third physical file based on a first access request to the first table space, according to the file size of the first physical file, the file size of the second physical file, and the order of creation of the first physical file and the second physical file, wherein the third physical file is the first physical file or the second physical file, and wherein the first access request includes the first access address; a first access module, used to access data in the first table space according to the second access address.

在一种可能的实施方式中,所述数据存储系统还包括:第一确定模块,用于在所述数据库系统重启时,确定所述第一数据目录内和所述至少一个第二数据目录内各自的物理文件中,与同一第二表空间关联的至少两个第四物理文件;记录模块,用于记录第一信息,其中,所述第一信息包括:与所述第二表空间关联的所述至少两个第四物理文件中每个物理文件的文件大小、以及所述至少两个第四物理文件中不同所述第四物理文件之间的创建先后顺序。In a possible implementation, the data storage system further includes: a first determination module, used to determine, when the database system is restarted, at least two fourth physical files associated with the same second table space in the respective physical files in the first data directory and in the at least one second data directory; a recording module, used to record first information, wherein the first information includes: the file size of each physical file in the at least two fourth physical files associated with the second table space, and the creation order between different fourth physical files in the at least two fourth physical files.

在一种可能的实施方式中,所述数据存储系统还包括:第二访问模块,用于基于对所述第二表空间的第二访问请求,依据对所述第二表空间记录的所述第一信息,在与所述第二表空间关联的至少一个所述第四物理文件中,访问所述第二表空间的数据。In a possible implementation, the data storage system also includes: a second access module, used to access the data of the second table space in at least one of the fourth physical files associated with the second table space based on a second access request to the second table space and in accordance with the first information recorded in the second table space.

在一种可能的实施方式中,所述数据存储系统还包括:第一创建模块,用于基于第二写入请求,在所述数据库系统中创建第三表空间,其中,所述第二写入请求包括请求向第三表空间写入的第二数据;第二创建模块,用于在所述第二数据目录内创建与所述第三表空间关联的第五物理文件;第二写入模块,用于将所述第二数据写入至所述第五物理文件。In a possible embodiment, the data storage system also includes: a first creation module, used to create a third table space in the database system based on a second write request, wherein the second write request includes a request to write second data to the third table space; a second creation module, used to create a fifth physical file associated with the third table space in the second data directory; and a second write module, used to write the second data to the fifth physical file.

在一种可能的实施方式中,所述数据存储系统还包括:第二确定模块,用于确定所述第一数据目录内和所述至少一个第二数据目录内各自的物理文件中,与同一第四表空间关联的至少两个第六物理文件;读取模块,用于读取所述至少两个第六物理文件内每个第六物理文件内的数据;拼接模块,用于基于所述至少两个第六物理文件中不同所述第六物理文件之间的创建先后顺序,按照创建时间从早到晚的顺序,将从所述至少两个第六物理文件分别读取的数据进行连接,以获取所述第四表空间的表数据;备份模块,用于将所述第四表空间的表数据进行备份。In a possible embodiment, the data storage system also includes: a second determination module, used to determine at least two sixth physical files associated with the same fourth table space in the respective physical files in the first data directory and the at least one second data directory; a reading module, used to read data in each of the at least two sixth physical files; a splicing module, used to connect the data read respectively from the at least two sixth physical files in order from earliest to latest in creation time based on the creation order between different sixth physical files in the at least two sixth physical files, so as to obtain the table data of the fourth table space; a backup module, used to back up the table data of the fourth table space.

在一种可能的实施方式中,所述第一物理文件在所述第二物理文件之前创建。In a possible implementation manner, the first physical file is created before the second physical file.

在一种可能的实施方式中,所述数据库系统的多个数据目录分别位于不同的文件系统。In a possible implementation, the multiple data directories of the database system are located in different file systems respectively.

在一种可能的实施方式中,所述数据库系统对应的多个所述文件系统对应的磁盘的磁盘类型不同。In a possible implementation manner, the disks corresponding to the multiple file systems corresponding to the database system are of different disk types.

上述各实施方式的数据库系统的数据存储系统的效果,与上述各实施方式的数据库系统的数据存储方法的效果类似,这里不再赘述。The effects of the data storage system of the database system of each of the above-mentioned embodiments are similar to the effects of the data storage method of the database system of each of the above-mentioned embodiments, and will not be described in detail here.

在一种可能的实施方式中,本申请提供一种数据库系统的数据存储装置。数据库系统的数据存储装置包括一个或多个接口电路和一个或多个处理器;所述接口电路用于从存储器接收信号,并向所述处理器发送所述信号,所述信号包括存储器中存储的计算机指令;当所述处理器执行所述计算机指令时,所述处理器可实现上述任意一种实施方式中的方法。In a possible implementation, the present application provides a data storage device of a database system. The data storage device of the database system includes one or more interface circuits and one or more processors; the interface circuit is used to receive a signal from a memory and send the signal to the processor, the signal including a computer instruction stored in the memory; when the processor executes the computer instruction, the processor can implement the method in any of the above implementations.

本实施方式的数据库系统的数据存储装置的效果,与上述各实施方式的数据库系统的数据存储方法的效果类似,这里不再赘述。The effect of the data storage device of the database system of this embodiment is similar to the effect of the data storage method of the database system of the above-mentioned embodiments, and will not be described in detail here.

在一种可能的实施方式中,本申请提供一种计算机可读存储介质。计算机可读存储介质存储有计算机程序,当计算机程序运行在计算机或处理器上时,使得计算机或处理器执行上述任意一种实施方式中的方法。In a possible implementation, the present application provides a computer-readable storage medium. The computer-readable storage medium stores a computer program, and when the computer program runs on a computer or a processor, the computer or the processor executes the method in any one of the above implementations.

本实施方式的计算机可读存储介质的效果,与上述各实施方式的数据库系统的数据存储方法的效果类似,这里不再赘述。The effect of the computer-readable storage medium of this embodiment is similar to the effect of the data storage method of the database system of the above-mentioned embodiments, and will not be described in detail here.

在一种可能的实施方式中,本申请提供一种计算机程序产品。计算机程序产品包含软件程序,当软件程序被计算机或处理器执行时,使得上述任意一个实施方式中的方法被执行。In a possible implementation, the present application provides a computer program product. The computer program product includes a software program, and when the software program is executed by a computer or a processor, the method in any one of the above implementations is executed.

本实施方式的计算机程序产品的效果,与上述各实施方式的数据库系统的数据存储方法的效果类似,这里不再赘述。The effect of the computer program product of this embodiment is similar to the effect of the data storage method of the database system of the above-mentioned embodiments, and will not be described in detail here.

附图说明BRIEF DESCRIPTION OF THE DRAWINGS

为了更清楚地说明本申请实施例的技术方案,下面将对本申请实施例的描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动性的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the description of the embodiments 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.

图1为示例性示出的数据库管理系统的数据存储架构图;FIG1 is a diagram showing an exemplary data storage architecture of a database management system;

图2a为示例性示出的数据库管理系统的数据存储架构图;FIG2a is a diagram showing an exemplary data storage architecture of a database management system;

图2b为示例性示出的数据库管理系统的数据存储架构图;FIG2 b is a diagram showing an exemplary data storage architecture of a database management system;

图2c为示例性示出的数据库的备份数据的备份结构的示意图;FIG2c is a schematic diagram showing an exemplary backup structure of backup data of a database;

图3为本申请实施例提供的一种装置的结构示意图;FIG3 is a schematic diagram of the structure of a device provided in an embodiment of the present application;

图4为本申请实施例提供的一种芯片的结构示意图。FIG4 is a schematic diagram of the structure of a chip provided in an embodiment of the present application.

具体实施方式Detailed ways

下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

本文中术语“和/或”,仅仅是一种描述关联对象的关联关系,表示可以存在三种关系,例如,A和/或B,可以表示:单独存在A,同时存在A和B,单独存在B这三种情况。The term "and/or" in this article is merely a description of the association relationship of associated objects, indicating that three relationships may exist. For example, A and/or B can mean: A exists alone, A and B exist at the same time, and B exists alone.

本申请实施例的说明书和权利要求书中的术语“第一”和“第二”等是用于区别不同的对象,而不是用于描述对象的特定顺序。例如,第一目标对象和第二目标对象等是用于区别不同的目标对象,而不是用于描述目标对象的特定顺序。The terms "first" and "second" in the description and claims of the embodiments of the present application are used to distinguish different objects rather than to describe a specific order of objects. For example, a first target object and a second target object are used to distinguish different target objects rather than to describe a specific order of target objects.

在本申请实施例中,“示例性的”或者“例如”等词用于表示作例子、例证或说明。本申请实施例中被描述为“示例性的”或者“例如”的任何实施例或设计方案不应被解释为比其它实施例或设计方案更优选或更具优势。确切而言,使用“示例性的”或者“例如”等词旨在以具体方式呈现相关概念。In the embodiments of the present application, words such as "exemplary" or "for example" are used to indicate examples, illustrations or descriptions. Any embodiment or design described as "exemplary" or "for example" in the embodiments of the present application should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of words such as "exemplary" or "for example" is intended to present related concepts in a specific way.

在本申请实施例的描述中,除非另有说明,“多个”的含义是指两个或两个以上。例如,多个处理单元是指两个或两个以上的处理单元;多个系统是指两个或两个以上的系统。In the description of the embodiments of the present application, unless otherwise specified, the meaning of "multiple" refers to two or more than two. For example, multiple processing units refer to two or more processing units; multiple systems refer to two or more systems.

首先对以下名称进行定义:First, define the following names:

普通表:表示数据库系统的默认存储目录中已创建的表。Ordinary table: refers to the table that has been created in the default storage directory of the database system.

外表(External Tables):部分数据库支持将外部的普通数据文件,当做一张表来处理,那么该外部的普通数据文件可称为外表。External Tables: Some databases support treating external common data files as a table, so the external common data files can be called external tables.

表空间(Tablespace):是关系型数据库的逻辑划分单元,一个表空间只能属于一个数据库。所有的数据库对象都存放在指定的表空间中。但主要存放的是表,所以称作表空间,每个表空间拥有唯一的标识(TablespaceID),一张表对应一个表空间;Tablespace: It is a logical division unit of a relational database. A tablespace can only belong to one database. All database objects are stored in a specified tablespace. However, it mainly stores tables, so it is called a tablespace. Each tablespace has a unique identifier (TablespaceID), and one table corresponds to one tablespace.

数据目录:用于存储数据库的数据。Data directory: used to store database data.

下面简要介绍相关技术中的数据库系统的数据存储过程:The following briefly introduces the data storage process of the database system in the related technology:

相关技术1:Related technology 1:

MariaDB可支持将本地存储的只读表放入简单存储服务(Simple StorageService,S3)中,其中,S3为对象存储服务,其接口是当前对象存储的流行标准。以支持不同数据表存储在本地和S3。MariaDB can support putting read-only tables stored locally into Simple Storage Service (S3), where S3 is an object storage service whose interface is a popular standard for current object storage. This allows different data tables to be stored locally and in S3.

但是,MariaDB将数据表进行外部存储旨在用于数据归档存储或者旧数据共享,使得其仅支持将只读表进行外部存储。以及MariaDB仅支持最小存储单位为表的数据的外部存储,无法将表的部分数据进行外部存储。以及MariaDB将表导入到S3后,S3中的该表所支持的操作与MariaDB内的普通表所支持的操作并不完全一致,例如S3中的表不支持分区调整。However, MariaDB uses external storage of data tables for data archiving or old data sharing, so it only supports external storage of read-only tables. MariaDB also only supports external storage of data with the smallest storage unit being a table, and cannot store part of the data in a table externally. After MariaDB imports a table into S3, the operations supported by the table in S3 are not completely consistent with those supported by ordinary tables in MariaDB. For example, tables in S3 do not support partition adjustment.

相关技术2:Related technology 2:

Oracle数据库可利用外表来使用户就像使用数据库的普通表一样,使用数据库系统外部的普通文件。其中,该普通文件可以存放到任意位置,只要该数据库能读取到该普通文件内的数据即可。数据库中只记录了该普通文件的元数据信息,而不会将普通文件内的数据导入到数据库。Oracle database can use external tables to allow users to use ordinary files outside the database system just like using ordinary tables in the database. The ordinary file can be stored in any location as long as the database can read the data in the ordinary file. The database only records the metadata information of the ordinary file, and the data in the ordinary file will not be imported into the database.

但是,Oracle数据库只可以对外表进行读操作,无法进行写操作。以及外表只支持数据库的部分功能(例如不支持加密列),普通表支持的功能丰富。以及Oracle数据库使用外部的普通文件,也仅可以以表为最小单位来操作外部存储路径中的数据。However, Oracle database can only read external tables, but not write them. External tables only support some database functions (for example, encrypted columns are not supported), while ordinary tables support a wide range of functions. Oracle database uses external ordinary files, and can only operate data in external storage paths with tables as the smallest unit.

因此,相关技术中的数据库系统的存储方案,在支持将不同数据表的数据存储到不同的存储路径时,主要存在着不同存储路径内的表所支持的数据库操作不一致,以及存储在不同存储路径的数据的最小单位为表。Therefore, when supporting the storage of data from different data tables in different storage paths, the storage solutions of the database systems in the related art mainly have the problem that the database operations supported by the tables in different storage paths are inconsistent, and the smallest unit of data stored in different storage paths is the table.

针对以上相关技术中的数据库系统的存储方案所存在的上述技术问题,本申请提供了一种数据库系统的数据存储方法及装置,该方法可将一张表内的不同数据存储在不同的文件系统的目录中,使得数据库可以使用不同磁盘进行数据存储,且存储在不同磁盘中的表所支持的数据库操作可与普通表所支持的数据库操作相同。In response to the above-mentioned technical problems existing in the storage solutions of database systems in the above-mentioned related technologies, the present application provides a data storage method and device for a database system, which can store different data in a table in directories of different file systems, so that the database can use different disks for data storage, and the database operations supported by tables stored in different disks can be the same as the database operations supported by ordinary tables.

图1为示例性示出的本申请改进前的数据库管理系统的数据存储架构图。FIG. 1 is a diagram showing an exemplary data storage architecture of a database management system before improvement of the present application.

如图1所示,主机100可包括数据库管理系统(Database Management System,DBMS)101、文件系统104a以及磁盘103a(也称磁盘1)。As shown in FIG. 1 , a host 100 may include a database management system (DBMS) 101 , a file system 104 a , and a disk 103 a (also referred to as disk 1 ).

文件系统104a包括一个数据目录102a,其中,数据目录102a为图1所示的DBMS101的默认数据目录:/mnt/data。数据目录102a用于存储数据库的数据。The file system 104a includes a data directory 102a, wherein the data directory 102a is the default data directory /mnt/data of the DBMS 101 shown in Fig. 1. The data directory 102a is used to store database data.

其中,DBMS101以表空间来存储一张表的数据,一张表对应一个表空间。DBMS 101 uses a table space to store data of a table, and one table corresponds to one table space.

如图1所示,DBMS101中包括5个表空间,分别为表空间1至表空间5,每个表空间在文件系统104a内的数据目录102a中对应一个物理文件,每个表空间所存放的一张表的数据,存储在文件系统104a内的数据目录102a中的相应物理文件中。As shown in FIG. 1 , DBMS 101 includes five table spaces, namely, table space 1 to table space 5. Each table space corresponds to a physical file in the data directory 102a in the file system 104a. The data of a table stored in each table space is stored in the corresponding physical file in the data directory 102a in the file system 104a.

例如,表空间1至表空间5中每个表空间所存放的一张表的数据,分别存储在数据目录102a中的物理文件1a至物理文件5a中。For example, the data of a table stored in each of tablespaces 1 to 5 are respectively stored in physical files 1a to 5a in the data directory 102a.

而文件系统104a是磁盘1的逻辑地址的管理系统,那么物理文件1a至物理文件5a内的数据实际存储在磁盘1内。The file system 104 a is a management system for the logical addresses of the disk 1 , so the data in the physical files 1 a to 5 a are actually stored in the disk 1 .

但是,该DBMS101只支持一个数据目录,并且,DBMS101内的一个表空间只支持在一个物理文件内进行表数据的存储,相反,一个表空间无法支持多个物理文件进行表数据的存储。However, the DBMS 101 only supports one data directory, and a table space in the DBMS 101 only supports the storage of table data in one physical file. On the contrary, a table space cannot support multiple physical files for the storage of table data.

为此,本申请对图1所示的主机100、DBMS101进行改进,图2a为示例性示出的本申请改进后的数据库管理系统的数据存储架构图。To this end, the present application improves the host 100 and DBMS 101 shown in FIG. 1 , and FIG. 2 a is an illustrative diagram of the data storage architecture of the improved database management system of the present application.

如图2a所示,主机100可包括DBMS101、磁盘103a(例如主机101本地的磁盘1)、磁盘103a的文件系统104a。As shown in FIG. 2 a , the host 100 may include a DBMS 101 , a disk 103 a (eg, a local disk 1 of the host 101 ), and a file system 104 a of the disk 103 a .

此外,主机100还可挂载有磁盘103b,主机100内可创建有磁盘103b的文件系统104b。In addition, the host 100 may also mount a disk 103 b , and a file system 104 b of the disk 103 b may be created in the host 100 .

其中,文件系统104a可包括DBMS101的数据目录102a,文件系统104b可包括DBMS101的数据目录102b。The file system 104 a may include the data directory 102 a of the DBMS 101 , and the file system 104 b may include the data directory 102 b of the DBMS 101 .

对比于图1,在本申请实施例中,数据库不仅具有一个默认的数据目录102a(例如图2a所示的/mnt/data),还具有一个扩展的数据目录102b(例如图2a所示的/mnt/data_2)。当然在其他实施例中,数据库还可具有2个以上的数据目录(例如多个扩展的数据目录),本申请对此不做限制,其实现原理类似,这里不再赘述。Compared with FIG. 1 , in the embodiment of the present application, the database has not only a default data directory 102a (e.g., /mnt/data as shown in FIG. 2a ), but also an extended data directory 102b (e.g., /mnt/data_2 as shown in FIG. 2a ). Of course, in other embodiments, the database may also have more than two data directories (e.g., multiple extended data directories), which is not limited in the present application, and the implementation principle is similar, which will not be described here.

此外,在图2a的实施例中,数据库的不同数据目录(数据目录102a和数据目录102b)对应不同磁盘。在其他实施例中,本申请的数据库的不同数据目录也可以对应同一磁盘,例如在同一磁盘的文件系统内不仅创建有数据库的默认的数据目录102a,还创建有数据库的扩展的数据目录102b。本申请对于数据库的多个数据目录对应的磁盘是否相同不做限制。In addition, in the embodiment of FIG. 2a, different data directories of the database (data directory 102a and data directory 102b) correspond to different disks. In other embodiments, different data directories of the database of the present application may also correspond to the same disk, for example, in the file system of the same disk, not only the default data directory 102a of the database is created, but also the extended data directory 102b of the database is created. The present application does not limit whether the disks corresponding to the multiple data directories of the database are the same.

另外,数据库的数据目录对应的磁盘可以是本地磁盘,也可以是外部磁盘(例如云盘),本申请对于数据库的数据目录所对应的磁盘类型不做限制。例如图2a中磁盘103a为主机的本地磁盘,磁盘103b为云盘。In addition, the disk corresponding to the data directory of the database can be a local disk or an external disk (such as a cloud disk). This application does not limit the disk type corresponding to the data directory of the database. For example, in Figure 2a, disk 103a is the local disk of the host, and disk 103b is a cloud disk.

继续参照图2a,通过在数据库中建表,可在DBMS101中创建对应该表的表空间,其中,如图1所示,在创建数据目录102b之前,数据库中已创建了6个表,对应的表空间分别为表空间1至表空间5,在将数据目录102b也设置为数据库的数据目录后,DBMS101基于业务请求新建了一个表,该表对应于表空间6。Continuing with reference to FIG2a, by creating a table in the database, a table space corresponding to the table can be created in DBMS101. As shown in FIG1, before creating the data directory 102b, 6 tables have been created in the database, and the corresponding table spaces are table space 1 to table space 5. After the data directory 102b is also set as the data directory of the database, DBMS101 creates a new table based on the business request, and the table corresponds to table space 6.

示例性的,表空间1至表空间5为本申请的方法对DBMS101创建数据目录102b之前(例如DBMS101仅具有一个数据目录102a时)创建的表空间。Exemplarily, tablespaces 1 to 5 are tablespaces created before the method of the present application creates the data directory 102 b for the DBMS 101 (for example, when the DBMS 101 has only one data directory 102 a ).

示例性的,在本申请的方法对DBMS101创建数据目录102b之后,再次在数据库中新建表(例如建立表6)时,则在DBMS101内创建了对应表6的表空间6。Exemplarily, after the method of the present application creates the data directory 102 b for the DBMS 101 , when a new table is created in the database again (for example, table 6 is created), a table space 6 corresponding to table 6 is created in the DBMS 101 .

应理解,本申请对于DBMS101内的表空间的数量不做限制,以及在对数据库创建数据目录102b之后,所创建的表空间的数量也不做限制,其中,在创建数据目录102b之后所创建的表空间及相关方案的实现原理,与这里对表空间6的举例的原理类似,这里不再赘述。It should be understood that the present application does not limit the number of table spaces within DBMS101, and does not limit the number of table spaces created after creating the data directory 102b for the database. The implementation principles of the table spaces and related solutions created after creating the data directory 102b are similar to the principles of the example of table space 6 here, and will not be repeated here.

下面结合图2a、图2b,以表空间201(也称表空间1)为例,来介绍对数据库的表空间201的表数据的访问过程。对于图2a中表空间2至表空间5的数据访问过程,与图2a中对表空间1的举例类似,后续不再赘述。In the following, with reference to FIG. 2a and FIG. 2b, table space 201 (also referred to as table space 1) is used as an example to describe the process of accessing table data in table space 201 of the database. The process of accessing data in table space 2 to table space 5 in FIG. 2a is similar to the example of table space 1 in FIG. 2a, and will not be described in detail later.

如上文所述,表空间1至表空间5为本申请的方法对DBMS101创建数据目录102b之前(例如DBMS101仅具有一个数据目录102a时)创建的表空间。如图1和图2a所示,DBMS101内的每个表空间在数据目录102a内对应有各自的一个物理文件,对于表空间1至表空间5,依次对应的物理文件分别为物理文件1a至物理文件5a,物理文件1a至物理文件5a分别存储有表空间1至表空间5的表数据。As described above, tablespaces 1 to 5 are tablespaces created by the method of the present application before creating data directory 102b for DBMS 101 (for example, when DBMS 101 has only one data directory 102a). As shown in FIG. 1 and FIG. 2a , each tablespace in DBMS 101 corresponds to a respective physical file in data directory 102a. For tablespaces 1 to 5, the corresponding physical files are respectively physical files 1a to physical files 5a, and physical files 1a to physical files 5a store table data of tablespaces 1 to 5, respectively.

以数据库为RDS MySQL为例来说明,对比于图1,请参照图2a,管理软件可将磁盘103b挂载到RDS MySQL实例所在的主机100(或者虚机),并对该磁盘103b创建文件系统104b,以及在该文件系统104b内创建数据目录102b(例如/mnt/data_2),此时该数据目录102b不包括任何数据,为空目录。随着业务对数据库的数据写入,该数据目录102b内不断增加被写入数据的表空间对应的物理文件,以及该物理文件内可写入该表空间的数据。Taking the database RDS MySQL as an example, please refer to FIG2a in comparison with FIG1. The management software can mount the disk 103b to the host 100 (or virtual machine) where the RDS MySQL instance is located, and create a file system 104b for the disk 103b, and create a data directory 102b (for example, /mnt/data_2) in the file system 104b. At this time, the data directory 102b does not include any data and is an empty directory. As the business writes data to the database, the physical files corresponding to the tablespace where the data is written are continuously added in the data directory 102b, and the data in the tablespace that can be written in the physical file is continuously added.

然后,本申请的数据库管理系统101或数据库管理员(Database Administrator,DBA),通过set命令对该RDS MySQL数据库设置扩展的数据目录102b。Then, the database management system 101 of the present application or the database administrator (Database Administrator, DBA) sets the extended data directory 102b for the RDS MySQL database through a set command.

例如在图1的场景下,DBMS已在磁盘103a中存储有5个表(对应于表空间1至表空间5)的数据,此时,确定数据目录102a对应的磁盘103a的存储空间不足,或者磁盘103a性能较差时,那么DBMS101或DBA可将如图2a所示的数据目录102b设置为该RDS MySQL数据库的二级数据目录(即扩展的数据目录),以实现对数据库指定新的数据目录。For example, in the scenario of FIG. 1 , the DBMS has stored data of five tables (corresponding to tablespaces 1 to 5) in disk 103a. At this time, if it is determined that the storage space of disk 103a corresponding to data directory 102a is insufficient, or the performance of disk 103a is poor, DBMS 101 or the DBA may set data directory 102b as shown in FIG. 2a as the secondary data directory (i.e., the extended data directory) of the RDS MySQL database to specify a new data directory for the database.

例如,数据库管理系统101或数据库管理员(Database Administrator,DBA)可通过set命令,将数据目录102b的地址(这里为/mnt/data_2)作为一个参数,写入RDS MySQL数据库的元数据文件(数据库的一种配置文件),当然也可以写入数据库的其他文件,这里不做限制。For example, the database management system 101 or the database administrator (DBA) can use the set command to write the address of the data directory 102b (here /mnt/data_2) as a parameter into the metadata file (a configuration file of the database) of the RDS MySQL database. Of course, other files of the database can also be written, and there is no limitation here.

在一种可能的实施方式中,在将数据目录102b设置为该RDS MySQL数据库的数据目录之后,该RDS MySQL数据库的数据目录不仅包括数据目录102a,还包括数据目录102b。在将数据目录102b设置为该RDS MySQL数据库的数据目录之后,在该RDS MySQL数据库中新产生的数据库数据、或新建的表可存储在数据目录102b,以在磁盘103b内存储数据库数据。In a possible implementation, after the data directory 102b is set as the data directory of the RDS MySQL database, the data directory of the RDS MySQL database includes not only the data directory 102a but also the data directory 102b. After the data directory 102b is set as the data directory of the RDS MySQL database, newly generated database data or newly created tables in the RDS MySQL database can be stored in the data directory 102b, so that the database data is stored in the disk 103b.

如图2b所示,表空间201在逻辑上由多个数据页组成,在数据目录102b内创建物理文件1b之前,表空间201包括100个数据页,分别为数据页4001至数据页4100。一个表空间内的数据页是数据库中最小的数据存储单元,数据页的大小对应物理存储空间上特定数量的存储字节(例如磁盘块),且同一表空间内的不同数据页在物理上对应大小相等的多个磁盘块。例如在将图2a所示的数据目录102b设置为该RDS MySQL数据库的数据目录之前,表空间201内的100个数据页的数据均存储在默认的数据目录102a内的物理文件202a中,且物理文件202a已与表空间1关联。如图2b所示,物理文件202a内的表空间201的100个数据页的数据,分别存储在磁盘103a的100个磁盘块内,这里分别为磁盘块3001a至磁盘块3100a。例如数据页4001的数据通过物理文件202a存储在磁盘块3001a内。As shown in FIG2b, table space 201 is logically composed of multiple data pages. Before physical file 1b is created in data directory 102b, table space 201 includes 100 data pages, namely data page 4001 to data page 4100. A data page in a table space is the smallest data storage unit in a database. The size of a data page corresponds to a specific number of storage bytes (such as disk blocks) on a physical storage space, and different data pages in the same table space physically correspond to multiple disk blocks of equal size. For example, before data directory 102b shown in FIG2a is set as the data directory of the RDS MySQL database, the data of 100 data pages in table space 201 are all stored in physical file 202a in the default data directory 102a, and physical file 202a is associated with table space 1. As shown in FIG2b, the data of 100 data pages of table space 201 in physical file 202a are respectively stored in 100 disk blocks of disk 103a, which are disk blocks 3001a to disk blocks 3100a. For example, the data of data page 4001 is stored in disk block 3001a via physical file 202a.

应理解,图2b所示的磁盘103a内的不同磁盘块之间,不限制为连续物理地址或者不连续物理地址。It should be understood that different disk blocks in the disk 103a shown in FIG. 2b are not limited to continuous physical addresses or discontinuous physical addresses.

例如,在将图2a所示的数据目录102b设置为该RDS MySQL数据库的数据目录之后,例如根据业务需求需要在表1对应的表空间1内继续写入数据,例如此时数据页4100已写满,则DBMS101可在表空间中创建数据页4101,并根据业务需求,将待插入(即写入)该表空间1的数据写入到数据页4101,具体过程将在下文阐述。For example, after the data directory 102b shown in Figure 2a is set as the data directory of the RDS MySQL database, for example, according to business needs, data needs to continue to be written in the table space 1 corresponding to the table 1. For example, at this time, the data page 4100 is full, then DBMS101 can create a data page 4101 in the table space, and according to business needs, write the data to be inserted (i.e., written) into the table space 1 into the data page 4101. The specific process will be explained below.

在图1中表空间1仅对应有数据目录102a内的一个物理文件1a,但是,在本申请改进后的图2a中,数据库还增设有数据目录102b。In FIG. 1 , table space 1 corresponds to only one physical file 1a in data directory 102a . However, in FIG. 2a after improvement in the present application, the database is further provided with a data directory 102b .

在一种可能的实施方式中,DBMS101接收到业务请求,该业务请求表示请求向与表空间1写入数据时,那么DBMS101可在数据目录102b内新建空的物理文件1b。以及DBMS101可将数据目录102b内的新建的物理文件1b与表空间1关联起来,并保存该关联关系,使得表空间1不仅与数据目录102a内的物理文件1a相关联,还与数据目录102b内的物理文件1b相关联、以此实现同一表空间与不同数据目录内的物理文件的关联,以便于该表空间内的表数据在不同数据目录内的物理文件内进行存储和访问。In a possible implementation, when DBMS101 receives a service request indicating a request to write data to tablespace 1, DBMS101 may create a new empty physical file 1b in data directory 102b. DBMS101 may associate the newly created physical file 1b in data directory 102b with tablespace 1 and save the association, so that tablespace 1 is associated not only with physical file 1a in data directory 102a but also with physical file 1b in data directory 102b, thereby realizing the association between the same tablespace and physical files in different data directories, so that the table data in the tablespace can be stored and accessed in physical files in different data directories.

例如,可通过将新建的物理文件1b的文件名称与已于表空间1关联的物理文件1a的文件名称相同的方式,来将物理文件1a与物理文件1b,均关联至表空间1。例如物理文件1和物理文件2的名称均为表空间1对应的表1的名称(例如XX表)。For example, physical file 1a and physical file 1b can be associated with tablespace 1 by making the file name of the newly created physical file 1b the same as the file name of the physical file 1a that is already associated with tablespace 1. For example, the names of physical file 1 and physical file 2 are both the name of table 1 corresponding to tablespace 1 (for example, table XX).

再如,本申请对于新建的物理文件1b的文件名称不做限制,但是在新建物理文件1b后,DBMS101可将物理文件1b的文件名称与表空间1的名称关联起来,并将该关联信息作为物理文件1b的元数据存储至数据库内。而在创建数据目录102b之前,预先创建的物理文件1a已与表空间1关联,这样,同样可以达到将物理文件1a、物理文件1b均与表空间1关联的效果。For another example, the present application does not restrict the file name of the newly created physical file 1b, but after the new physical file 1b is created, DBMS101 can associate the file name of the physical file 1b with the name of the tablespace 1, and store the association information as metadata of the physical file 1b in the database. Before creating the data directory 102b, the pre-created physical file 1a has been associated with the tablespace 1, so that the effect of associating both the physical file 1a and the physical file 1b with the tablespace 1 can also be achieved.

此外,在实现物理文件与表空间的关联时,也不限制于使用文件名称或表名称来实现其关联,也可以使用其他能够标识物理文件或表空间的信息,来实现该关联关系的建立。In addition, when realizing the association between a physical file and a table space, it is not limited to using a file name or a table name to realize the association, and other information that can identify a physical file or a table space can also be used to realize the establishment of the association relationship.

这样,在将数据目录102b设置为DBMS101的数据目录之后,DBMS接收到对表空间1至表空间5中任意一个表空间的数据写入请求后,可在数据目录102b内创建对应相应表空间的物理文件,这里的物理文件分别为如图2a所示的分别对应于表空间1至表空间5的物理文件1b至物理文件5b,以及DBMS101可将数据目录102b内新创建的物理文件与相应的表空间建立关联关系,使得同一表空间可关联有数据目录102a内的相应物理文件,以及数据目录102b内的相应物理文件。而在该数据写入请求对应的数据被写入到相应表空间之前,该物理文件1b至物理文件5b均为空文件,随着数据的写入,文件大小不断增长。In this way, after setting the data directory 102b as the data directory of DBMS101, after receiving a data write request for any tablespace from tablespace 1 to tablespace 5, DBMS can create a physical file corresponding to the corresponding tablespace in the data directory 102b, where the physical files are respectively physical files 1b to physical files 5b corresponding to tablespace 1 to tablespace 5 as shown in FIG2a, and DBMS101 can establish an association relationship between the newly created physical files in the data directory 102b and the corresponding tablespace, so that the same tablespace can be associated with the corresponding physical files in the data directory 102a and the corresponding physical files in the data directory 102b. Before the data corresponding to the data write request is written into the corresponding tablespace, the physical files 1b to physical files 5b are all empty files, and the file size continues to grow as the data is written.

继续以表空间1为例,如图2b所示,在DBMS101将数据目录102a内的物理文件1a、数据目录102b内的新建的物理文件1b,均与表空间1关联起来,并保存该关联关系之后,DBMS101可响应于向与表空间1写入数据的业务请求,将待插入该表空间1的数据写入到数据页4101,其中,数据页4101只是逻辑上的存储地址,DBMS101可将需要写入到数据页4101的数据,写入到物理文件1b,本次插入该表空间1的数据页4101内的数据实际则存储在磁盘103b的磁盘块3001b内。这样,为了实现一张表的数据存放在不同的数据目录中,本申请将表空间以一个或多个数据页为单位,一个或多个数据页可对应有一个数据目录内的一个物理文件,从而将表空间对应的物理文件拆分成多个物理文件,并且这些物理文件可以分别在不同的数据目录中。相比于相关技术中只可以以表为单位进行不同存储位置的数据存储,本申请可以单个表内的一个或多个数据页为单位,来实现同一张表的不同数据页在不同存储位置的数据存储,并能够以数据页的粒度指定数据的存储位置。Continuing to take table space 1 as an example, as shown in FIG2b, after DBMS101 associates the physical file 1a in the data directory 102a and the newly created physical file 1b in the data directory 102b with table space 1 and saves the association, DBMS101 can respond to a business request to write data to table space 1 and write the data to be inserted into the table space 1 into data page 4101, wherein data page 4101 is only a logical storage address, DBMS101 can write the data to be written into data page 4101 into physical file 1b, and the data inserted into data page 4101 of the table space 1 is actually stored in disk block 3001b of disk 103b. In this way, in order to store the data of a table in different data directories, the present application uses the table space as a unit of one or more data pages, and one or more data pages can correspond to a physical file in a data directory, thereby splitting the physical file corresponding to the table space into multiple physical files, and these physical files can be in different data directories respectively. Compared to the related art which can only store data in different storage locations on a table basis, the present application can use one or more data pages within a single table as units to implement data storage in different storage locations for different data pages of the same table, and can specify the storage location of data at the granularity of data pages.

应理解,图2b中,仅以待插入表空间1的数据写入到数据页4101为例来说明,在向表空间1进行数据库数据插入操作的场景下,物理文件1b对应的数据页的数量不限于一个或多个,例如插入数据量较大,则单次向物理文件1b写入的数据量对应的数据页可以是多个。It should be understood that in Figure 2b, only the data to be inserted into tablespace 1 is written into data page 4101 as an example. In the scenario of inserting database data into tablespace 1, the number of data pages corresponding to physical file 1b is not limited to one or more. For example, if the amount of inserted data is large, the data pages corresponding to the amount of data written to physical file 1b at a single time can be multiple.

此外,在写入数据到物理文件1b的场景下,向物理文件1b所写入的数据在表空间1中对应的数据页,也可以当前已存在的、但是数据量还未写满的数据页内,例如数据页4002的大小为10k,但是数据页4002内只写入了8k数据,则本次待插入表空间1的数据,也可以有2k数据写入到数据页4002,这样,数据页4002可对应8k数据写入到物理文件1a中,还有2k数据写入到物理文件1b中。In addition, in the scenario of writing data to physical file 1b, the data page corresponding to the data written to physical file 1b in table space 1 can also be in a data page that currently exists but has not been filled with data. For example, the size of data page 4002 is 10k, but only 8k of data is written to data page 4002. Then, the data to be inserted into table space 1 this time can also have 2k of data written to data page 4002. In this way, data page 4002 can correspond to 8k of data written to physical file 1a, and 2k of data written to physical file 1b.

例如图2b中还示出了磁盘103b的磁盘块3002至磁盘块3100等,那么在数据目录102b设置为数据库的数据目录后,DBMS101可根据业务请求而向图2a所示的表空间2至表空间5首次插入数据时,则同样可在数据目录102b内创建关联于相应表空间的物理文件2b至物理文件5b,并根据业务请求,而将待插入至表空间2至表空间5的数据,写入到该物理文件2b至物理文件5b,而插入至表空间2至表空间5的数据,则实际存储在磁盘103b的磁盘块内,例如磁盘块3002至磁盘块3100,被写入数据的磁盘块的数量不做限制,具体可根据业务需求而确定。以及这里对待插入至表空间2至表空间5的数据,写入到哪个磁盘块也不做限制。在数据目录102b设置为数据库的数据目录后,DBMS101根据业务请求,将数据插入至表空间2至表空间5中任意一个表空间的实现过程的原理,与上述针对图2b所介绍的将数据插入至表空间1的实现过程的原理类似,这里不再赘述。For example, FIG. 2b also shows disk blocks 3002 to 3100 of disk 103b, etc. Then, after data directory 102b is set as the data directory of the database, DBMS 101 can insert data into tablespaces 2 to 5 shown in FIG. 2a for the first time according to a business request, and can also create physical files 2b to 5b associated with the corresponding tablespaces in data directory 102b, and write the data to be inserted into tablespaces 2 to 5 into the physical files 2b to 5b according to the business request, and the data inserted into tablespaces 2 to 5 are actually stored in the disk blocks of disk 103b, such as disk blocks 3002 to 3100, and the number of disk blocks to which data is written is not limited, and can be determined according to business requirements. And here, there is no restriction on which disk block the data inserted into tablespaces 2 to 5 is written. After data directory 102b is set as the data directory of the database, the principle of implementing the process of DBMS101 inserting data into any table space from table space 2 to table space 5 according to the business request is similar to the principle of implementing the process of inserting data into table space 1 described above with respect to FIG. 2b, and will not be repeated here.

这样,如图2a所示,DBMS101内的表空间1的表数据可存储在数据目录102a内的物理文件1a以及数据目录102b内的物理文件1b内。同理,DBMS101内的表空间2的表数据可存储在数据目录102a内的物理文件2a以及数据目录102b内的物理文件2b内;DBMS101内的表空间3的表数据可存储在数据目录102a内的物理文件3a以及数据目录102b内的物理文件3b内;DBMS101内的表空间4的表数据可存储在数据目录102a内的物理文件4a以及数据目录102b内的物理文件4b内;DBMS101内的表空间5的表数据可存储在数据目录102a内的物理文件5a以及数据目录102b内的物理文件5b内。这样,一个表空间可对应有至少两个物理文件,并且该至少两个物理文件可与相应的同一表空间关联,从而使得该至少两个物理文件可组成一个逻辑的表空间。这样,可将同一表空间的不同数据页的数据存储在不同的文件系统中,以实现在不同类型的磁盘内存储同一表空间的数据。Thus, as shown in FIG. 2a , table data of table space 1 in DBMS 101 can be stored in physical file 1a in data directory 102a and physical file 1b in data directory 102b. Similarly, table data of table space 2 in DBMS 101 can be stored in physical file 2a in data directory 102a and physical file 2b in data directory 102b; table data of table space 3 in DBMS 101 can be stored in physical file 3a in data directory 102a and physical file 3b in data directory 102b; table data of table space 4 in DBMS 101 can be stored in physical file 4a in data directory 102a and physical file 4b in data directory 102b; table data of table space 5 in DBMS 101 can be stored in physical file 5a in data directory 102a and physical file 5b in data directory 102b. Thus, one table space can correspond to at least two physical files, and the at least two physical files can be associated with the same corresponding table space, so that the at least two physical files can form a logical table space. In this way, data of different data pages of the same table space can be stored in different file systems, so as to realize the storage of data of the same table space in different types of disks.

应理解,数据目录102b内具体包括DBMS101内哪些表空间的物理文件,取决于数据库的表空间的访问情况,如果在对数据库设置数据目录102b之后,业务没有请求向DBMS101内已创建的表空间写入数据,则数据目录102b不会创建有与该表空间关联的物理文件,例如数据目录102b不会包括与数据目录102a内的相应表空间的物理文件同名的物理文件。It should be understood that which physical files of the tablespaces in DBMS101 are specifically included in the data directory 102b depends on the access conditions of the tablespaces in the database. If, after setting the data directory 102b for the database, the business does not request to write data to the tablespaces created in DBMS101, the data directory 102b will not create physical files associated with the tablespace. For example, the data directory 102b will not include physical files with the same names as the physical files of the corresponding tablespaces in the data directory 102a.

本申请区别于相关技术1,本申请的任何类型的表(不限于只读表)都可以存储在默认的数据目录102a之外的扩展的数据目录中。The present application is different from the related art 1 in that any type of table (not limited to read-only tables) of the present application can be stored in an extended data directory outside the default data directory 102a.

另外,本申请中,对数据库新增设置的扩展的数据目录的数量不仅可以是上述实施例方式所举例的一个,也可以是2个或2个以上。在扩展的数据目录的数量为2个或2个以上时,数据库的不同数据目录(包括默认的数据目录和扩展的数据目录)内关联同一表空间的不同物理文件之间也具有文件的创建顺序,那么在访问该表空间的数据时,可依据该表空间的不同物理文件之间的创建顺序,来访问相应物理文件内的表数据,具体原理,与扩展的数据目录的数量为一个的原理类似,这里不再赘述。In addition, in the present application, the number of extended data directories newly set for the database can be not only one as exemplified in the above embodiment, but also two or more. When the number of extended data directories is two or more, different physical files associated with the same table space in different data directories of the database (including the default data directory and the extended data directory) also have a file creation order, so when accessing the data of the table space, the table data in the corresponding physical file can be accessed according to the creation order between different physical files of the table space. The specific principle is similar to the principle of one extended data directory, which will not be repeated here.

应理解,在对数据库增设数据目录时,不限制为该数据库已有的数据目录对应的磁盘空间已满或性能较差,才去增设数据目录。以及,在扩展的数据目录的数量为2个或2个以上时(例如扩展的数据目录包括如图2a所示的数据目录102b、以及新增的未示出的数据目录102c),本申请不限制为在将同一表空间的数据在数据目录102b对应的磁盘103b写满的情况下,才去在数据目录102c中创建与该表空间关联的物理文件,并将待写入至该表空间的数据写入到数据目录102c内的相应物理文件。也就是说,本申请对于不同数据目录之间对应于同一表空间的不同物理文件,它们之间的创建顺序和数据写入顺序不做限制。It should be understood that when adding a data directory to a database, it is not limited to adding a data directory only when the disk space corresponding to the existing data directory of the database is full or the performance is poor. Also, when the number of extended data directories is 2 or more (for example, the extended data directory includes the data directory 102b shown in Figure 2a, and the newly added data directory 102c not shown), the present application is not limited to creating a physical file associated with the table space in the data directory 102c and writing the data to be written to the table space to the corresponding physical file in the data directory 102c only when the data of the same table space is filled on the disk 103b corresponding to the data directory 102b. In other words, the present application does not limit the creation order and data writing order of different physical files corresponding to the same table space between different data directories.

在一些实施例中,本申请的应用场景可以是云环境下的数据库系统,图2a所示的主机100也可以是计算集群中的一台服务器,在一些实施例中,如图2a所示的主机100也可以是计算集群中的虚机,本申请对此不做限制。In some embodiments, the application scenario of the present application can be a database system in a cloud environment, and the host 100 shown in Figure 2a can also be a server in a computing cluster. In some embodiments, the host 100 shown in Figure 2a can also be a virtual machine in a computing cluster, and the present application does not impose any restrictions on this.

示例性的,在云环境下,数据库的宿主机(或者虚机)往往可以方便地使用各种类型的存储盘,例如本地盘、串口(Serial Advanced Technology Attachment,SATA)云盘、固态驱动器(Solid State Disk,SSD)云盘等。不同类型的存储盘往往具有不同的价格、速度、存储容量等。在云环境下,本地盘容量往往有限制,而云盘的容量上限往往很大。为了能使数据库系统既利用本地盘的高速度,又可以利用云盘的大容量,在一些场景下,本申请可将云盘挂载至数据库宿主机上,以将云盘的数据目录作为数据库的扩展的数据目录。这样,在该应用场景下,本申请可将表空间的部分数据存储至默认的数据目录102a,以利用磁盘103a(例如本地的磁盘1)进行数据的高速访问,以及将表空间的另一部分数据存储在扩展的数据目录102b,以利用磁盘103b(例如云盘)来进行数据的海量存储,这样可实现数据库数据的高速访问和海量存储。Exemplarily, in a cloud environment, the host machine (or virtual machine) of the database can often conveniently use various types of storage disks, such as local disks, Serial Advanced Technology Attachment (SATA) cloud disks, Solid State Disk (SSD) cloud disks, etc. Different types of storage disks often have different prices, speeds, storage capacities, etc. In a cloud environment, the capacity of local disks is often limited, while the upper limit of the capacity of cloud disks is often very large. In order to enable the database system to utilize both the high speed of local disks and the large capacity of cloud disks, in some scenarios, the present application can mount the cloud disk on the database host machine to use the data directory of the cloud disk as an extended data directory of the database. In this way, in this application scenario, the present application can store part of the data of the table space in the default data directory 102a, so as to use the disk 103a (such as the local disk 1) for high-speed access to data, and store another part of the data of the table space in the extended data directory 102b, so as to use the disk 103b (such as the cloud disk) for mass storage of data, so as to achieve high-speed access and mass storage of database data.

在一种可能的实施方式中,在对数据库设置数据目录102b之后,在如图2a所示的对应于表空间1至表空间5的物理文件1b至物理文件5b已创建完成,并且物理文件1b至物理文件5b已分别与表空间1至表空间5关联后,在DBMS101再次接收到对表空间1至表空间5中任意一个表空间(以表空间1为例)的数据访问请求(可包括数据的插入、删除、修改、查询等任意一种数据库操作)时,DBMS101可基于该数据访问请求,以及物理文件1a的文件大小、物理文件1b的文件大小,以及物理文件1a与物理文件1b的创建先后顺序,在与表空间1关联的物理文件1a和/或物理文件1b中确定本次需要访问的物理文件,并基于该数据访问请求,对在表空间1中所需要访问的数据页,映射至相应物理文件对应的磁盘块进行数据访问,以实现数据库的访问。In a possible implementation, after setting the data directory 102b for the database, after the physical files 1b to 5b corresponding to tablespaces 1 to 5 as shown in FIG. 2a have been created, and the physical files 1b to 5b have been associated with tablespaces 1 to 5, respectively, when DBMS 101 receives a data access request (which may include any database operation such as data insertion, deletion, modification, and query) for any tablespace 1 to 5 (taking tablespace 1 as an example) again, DBMS 101 may determine the physical file to be accessed this time in the physical file 1a and/or the physical file 1b associated with the tablespace 1 based on the data access request, the file size of the physical file 1a, the file size of the physical file 1b, and the order in which the physical files 1a and 1b are created, and based on the data access request, map the data pages to be accessed in tablespace 1 to the disk blocks corresponding to the corresponding physical files for data access, so as to achieve database access.

由于DMBS101以数据库对象(例如表空间)来响应业务的数据访问请求的,而本申请只是将表空间对应的数据页的存储位置进行改变,使得表空间对应的物理文件可为2个或2个以上,这样,面向业务的表空间并没有改变,从而使得业务无法感知到物理文件的变化。触发业务的用户不需要新建数据库的表或者修改数据库的表来使用扩展的数据目录102b。以及对于数据页位于多个数据目录的表(例如表空间1至表空间5中的任意一个表空间对应的表),可支持普通表所具有的所有数据库功能。Since DMBS101 responds to the data access request of the business with database objects (such as table spaces), and this application only changes the storage location of the data page corresponding to the table space, so that the physical files corresponding to the table space can be 2 or more, in this way, the business-oriented table space has not changed, so that the business cannot perceive the change of the physical file. The user who triggers the business does not need to create a new database table or modify the database table to use the extended data directory 102b. And for tables with data pages located in multiple data directories (such as tables corresponding to any table space from table space 1 to table space 5), all database functions of ordinary tables can be supported.

在一种可能的实施方式中,继续参照图2a,在对数据库设置数据目录102b之后,DBMS101接收到数据访问请求,例如该数据访问请求包括新建一个表(例如表6),以及向该表写入数据,则DBMS101可响应于该数据访问请求新建表空间6,此时该表空间6还未包括任何数据页,随着对该表空间6的数据写入,表空间6内的数据页逐渐增加。以及DBMS101可在数据目录102b内创建与该表空间6关联的物理文件6b,并保存该关联关系。In a possible implementation, referring to FIG. 2a , after the data directory 102b is set for the database, DBMS 101 receives a data access request, for example, the data access request includes creating a new table (such as table 6) and writing data to the table, then DBMS 101 can create a new table space 6 in response to the data access request, at which point the table space 6 does not yet include any data pages, and as data is written to the table space 6, the number of data pages in the table space 6 gradually increases. DBMS 101 can also create a physical file 6b associated with the table space 6 in the data directory 102b and save the association.

由于表空间6是在数据目录102b创建之后新建的表的表空间,表空间6可理解为新表,因此,表空间6当前在数据目录102a中不具有对应的物理文件。相反,表空间1至表空间5则是在对数据库设置数据目录102b之前就已经创建的表空间,则表空间1至表空间5均属于旧表,因此,在对数据库设置数据目录102b之前,该数据目录102a中已经创建有上述5个表空间的物理文件。Since tablespace 6 is a tablespace for a newly created table after data directory 102b is created, tablespace 6 can be understood as a new table, and therefore, tablespace 6 currently has no corresponding physical file in data directory 102a. On the contrary, tablespaces 1 to 5 are tablespaces that have been created before data directory 102b is set for the database, and tablespaces 1 to 5 are all old tables. Therefore, before data directory 102b is set for the database, physical files of the above five tablespaces have been created in data directory 102a.

继续描述DBMS101对上述表空间6的数据访问请求,在DBMS101在数据目录102b内创建与该表空间6关联的物理文件6b,并保存该关联关系之后,DBMS101可根据该数据访问请求,而向物理文件6b内写入待插入至表空间6的数据,以在磁盘103b内写入表空间6的数据,数据存储原理及过程,与图2b所示的过程类似,也是按照数据页和磁盘块进行数据的写入,这里不再赘述。这样,表空间6的表数据可存储在磁盘103b,而表空间1至表空间5的表数据可存储在磁盘103a,可选地进一步存储在磁盘103b。以实现不同表空间的表数据存储在不同存储位置的效果。Continuing to describe the data access request of DBMS101 to the above table space 6, after DBMS101 creates a physical file 6b associated with the table space 6 in the data directory 102b and saves the association relationship, DBMS101 can write the data to be inserted into the table space 6 into the physical file 6b according to the data access request, so as to write the data of the table space 6 into the disk 103b. The data storage principle and process are similar to the process shown in FIG. 2b, and the data is also written according to the data page and the disk block, which will not be repeated here. In this way, the table data of table space 6 can be stored in the disk 103b, and the table data of table space 1 to table space 5 can be stored in the disk 103a, and optionally further stored in the disk 103b. This achieves the effect of storing the table data of different table spaces in different storage locations.

在一种可能的实施方式中,随着如图2a所示的磁盘103a内保存的数据库数据的删除,使得磁盘103a内空闲的存储空间大于预设阈值,该预设阈值可根据需求而灵活配置,这里不做赘述。那么DBMS101在接收到对新表(例如表空间6)的数据插入请求后,则DBMS101可在数据目录102a内创建空的物理文件6a,并将物理文件6a与表空间6相关联,例如DBMS101可保存物理文件6a与表空间6的关联关系,这样表空间6不仅与数据目录102b内的物理文件6b关联,还与数据目录102a内的物理文件6a关联,使得同一表空间与不同数据目录内的物理文件关联。然后,DBMS101可根据该数据插入请求,而将数据写入到表空间6的至少一个数据页内,以及将该至少一个数据页的数据写入到物理文件6a,使得本次插入的数据库数据,存储至磁盘103a内的相应磁盘块内。这样,对于新表而言,同样能够实现同一表空间的不同数据页存储在不同的存储位置。In a possible implementation, as the database data stored in the disk 103a as shown in FIG. 2a is deleted, the free storage space in the disk 103a is greater than a preset threshold value, which can be flexibly configured according to the requirements, and will not be described in detail here. Then, after receiving a data insertion request for a new table (e.g., table space 6), DBMS101 can create an empty physical file 6a in the data directory 102a, and associate the physical file 6a with the table space 6. For example, DBMS101 can save the association relationship between the physical file 6a and the table space 6, so that the table space 6 is not only associated with the physical file 6b in the data directory 102b, but also associated with the physical file 6a in the data directory 102a, so that the same table space is associated with the physical files in different data directories. Then, DBMS101 can write the data into at least one data page of the table space 6 according to the data insertion request, and write the data of the at least one data page into the physical file 6a, so that the database data inserted this time is stored in the corresponding disk block in the disk 103a. In this way, for a new table, different data pages of the same table space can also be stored in different storage locations.

这样,在本申请实施例中,数据目录102a和数据目录102b可分别存储DBMS101的同一表空间的不同物理文件,和/或,不同表空间的物理文件。Thus, in the embodiment of the present application, the data directory 102a and the data directory 102b may respectively store different physical files of the same table space of the DBMS 101 and/or physical files of different table spaces.

上述实施方式主要描述在数据目录102b设置为数据库的数据目录之后,对旧表写入数据,以及创建新表(例如表空间6)并向新表写入数据的过程,该过程中涉及在数据目录102b内创建相应被访问的表的表空间对应的物理文件,以及保存该物理文件与该表空间的关联关系的步骤。例如,物理文件与表空间的关联关系可保存在数据库的配置文件(例如元数据文件)中。The above embodiment mainly describes the process of writing data to an old table, creating a new table (e.g., tablespace 6) and writing data to the new table after the data directory 102b is set as the data directory of the database. The process involves creating a physical file corresponding to the tablespace of the corresponding accessed table in the data directory 102b, and saving the association relationship between the physical file and the tablespace. For example, the association relationship between the physical file and the tablespace can be saved in a configuration file (e.g., a metadata file) of the database.

那么为了确保每次数据库重启之后,数据库能够支持对关联了多个物理文件的表空间进行有效地数据访问的需求。在一种可能的实施方式中,每次数据库重启时,DBMS101可通过读取数据库的配置文件的方式,来读取到该数据库的数据目录的地址,这里为数据目录102a的地址(例如图2a所示的/mnt/data)和数据目录102b的地址(例如图2a所示的/mnt/data_2);然后,DBMS101依据数据目录102a的地址,对数据目录102a内的物理文件的信息(例如名称、大小等)进行扫描,以及DBMS101依据数据目录102b的地址,对数据目录102b内的物理文件的信息(例如名称、大小等)进行扫描,那么在同一表空间在数据目录102a和数据目录102b内均关联有物理文件时,则DBMS101可从两个数据目录扫描到同名的2个物理文件,例如,DBMS101扫描到名称均为“表空间1”的物理文件202a和物理文件202b,以此可以确定该两个物理文件均与表空间1关联,即说明该表空间1对应的一张表的数据存储在物理文件202a和物理文件202b内。Then, in order to ensure that the database can support the need for effective data access to tablespaces associated with multiple physical files after each database restart, in a possible implementation, each time the database is restarted, DBMS101 can read the address of the data directory of the database by reading the configuration file of the database, which is the address of the data directory 102a (for example, /mnt/data shown in FIG2a ) and the address of the data directory 102b (for example, /mnt/data_2 shown in FIG2a ); then, DBMS101 scans the information (for example, name, size, etc.) of the physical files in the data directory 102a according to the address of the data directory 102a, and DBMS101 scans the physical files in the data directory 102b according to the address of the data directory 102a. The address of the physical file in the data directory 102b is scanned (for example, name, size, etc.). If the same tablespace is associated with physical files in both the data directory 102a and the data directory 102b, DBMS101 can scan two physical files with the same name from the two data directories. For example, DBMS101 scans physical file 202a and physical file 202b both named "tablespace 1", thereby determining that the two physical files are associated with tablespace 1, which means that the data of a table corresponding to tablespace 1 is stored in physical file 202a and physical file 202b.

或者,在一种可能的实施方式中,DBMS101在将物理文件202b与表空间1关联时,关联方式不是通过创建与物理文件202a同名的物理文件202b的方式,而是通过将物理文件202b的名称与表空间1的名称进行关联,并将该关联关系保存在物理文件202b的元数据的方式,来实现物理文件202b与表空间1的关联的。那么在本实施方式中,数据库重启后,DBMS101可通过读取数据目录102b内各物理文件的元数据信息,从而可以确定各个物理文件具体关联到哪个表空间;以及DBMS101还可通过上述实施方式读取数据目录102a内物理文件的名称的方式(当然,也可以是其他实现方式,这里不做限制),来确定数据目录102a内各物理文件分别与哪个表空间关联,这样,DBMS101同样可以在数据库重启时,确定数据目录102a和数据目录102b内哪些物理文件与同一表空间关联,以及与哪个表空间关联的信息。Alternatively, in a possible implementation, when DBMS101 associates physical file 202b with tablespace 1, the association is not by creating a physical file 202b with the same name as physical file 202a, but by associating the name of physical file 202b with the name of tablespace 1 and saving the association in the metadata of physical file 202b. In this implementation, after the database is restarted, DBMS101 can determine which tablespace each physical file is specifically associated with by reading the metadata information of each physical file in data directory 102b; and DBMS101 can also determine which tablespace each physical file in data directory 102a is associated with by reading the names of physical files in data directory 102a in the above implementation (of course, other implementations are also possible and are not limited here). In this way, DBMS101 can also determine which physical files in data directory 102a and data directory 102b are associated with the same tablespace and which tablespace they are associated with when the database is restarted.

在数据库重启后,DBMS101可确定在数据目录102a、数据目录102b内与同一表空间关联的物理文件,进一步的,DBMS101可记录与同一表空间关联的至少两个物理文件的大小,以及至少两个物理文件的创建顺序的信息。After the database is restarted, DBMS 101 may determine the physical files associated with the same table space in data directories 102a and 102b. Furthermore, DBMS 101 may record the sizes of at least two physical files associated with the same table space and the creation order of at least two physical files.

以表空间1为例,其他表空间同理,这里不再赘述,每次在数据库重启之后,DBMS101可记录与表空间1关联的物理文件202a的文件大小和物理文件202b的文件大小,以及记录物理文件202a早于物理文件202b创建的信息。这样,在本次数据库重启之后,如果业务需要访问表空间1,则DBMS101可利用记录的上述文件大小的信息,以及文件创建早晚的顺序信息,来将本次待访问的表空间1内的数据页,映射到相应物理文件的磁盘块,以实现逻辑地址向物理地址的映射,以实现在不同数据目录内存储数据的表空间的数据的准确访问。Taking table space 1 as an example, the same is true for other table spaces, which will not be described here. Each time after the database is restarted, DBMS 101 can record the file size of physical file 202a and the file size of physical file 202b associated with table space 1, and record the information that physical file 202a was created earlier than physical file 202b. In this way, after the database is restarted this time, if the business needs to access table space 1, DBMS 101 can use the recorded file size information and the order information of the file creation to map the data page in table space 1 to be accessed this time to the disk block of the corresponding physical file, so as to realize the mapping of logical address to physical address, so as to realize the accurate access to the data of table spaces storing data in different data directories.

以图2b为例来说明,例如一个数据页大小为10k,物理文件202a存储了100个数据页,其文件大小为1000k,物理文件202b存储了一个数据页,其文件大小为10k。物理文件202a早于物理文件202b创建。应理解,DBMS101在向表空间1写入数据时,是依照顺序写入的,例如在数据页4001写满之后,才会创建数据页4002,在数据页4002写满之后才会创建数据页4003,以此类推,使得数据页4004至数据页4101依次写满,这里不再赘述。Take FIG. 2b as an example, for example, a data page size is 10k, physical file 202a stores 100 data pages, and its file size is 1000k, and physical file 202b stores one data page, and its file size is 10k. Physical file 202a is created earlier than physical file 202b. It should be understood that when DBMS101 writes data to table space 1, it writes in sequence, for example, after data page 4001 is full, data page 4002 will be created, and after data page 4002 is full, data page 4003 will be created, and so on, so that data pages 4004 to 4101 are filled in sequence, which will not be repeated here.

由于每个数据页的大小已知、且物理文件202a、物理文件202b的大小已知,且物理文件202a和物理文件202b的创建顺序已知,DBMS101可按照该创建顺序向物理文件写入数据,因此,DBMS101可确定物理文件202a存储了表空间1的前100个数据页的数据,物理文件202b存储了表空间1的第101个数据页的数据。而物理文件202a所处的文件系统104a为磁盘103a的文件系统,该文件系统104a与磁盘103a之间可具有地址之间的映射关系(这里可通过任何一种现有技术实现,不做限制),使得物理文件202a存储的100个数据页可映射至磁盘103a的相应100个磁盘块;同理,该文件系统104b与磁盘103b之间可具有地址之间的映射关系(这里可通过任何一种现有技术实现,不做限制),使得物理文件202b存储的1个数据页可映射至磁盘103b的相应1个磁盘块。这样,物理文件202a所存储的100个磁盘块自动映射至表空间1的第1至第100个数据页,物理文件202b所存储的一个磁盘块自动映射至表空间1的第101个数据页。Since the size of each data page is known, the sizes of physical file 202a and physical file 202b are known, and the creation order of physical file 202a and physical file 202b is known, DBMS101 can write data to the physical files in this creation order. Therefore, DBMS101 can determine that physical file 202a stores the data of the first 100 data pages of table space 1, and physical file 202b stores the data of the 101st data page of table space 1. The file system 104a where the physical file 202a is located is the file system of the disk 103a. The file system 104a and the disk 103a may have a mapping relationship between addresses (which may be implemented by any existing technology without limitation), so that the 100 data pages stored in the physical file 202a may be mapped to the corresponding 100 disk blocks of the disk 103a; similarly, the file system 104b and the disk 103b may have a mapping relationship between addresses (which may be implemented by any existing technology without limitation), so that one data page stored in the physical file 202b may be mapped to one corresponding disk block of the disk 103b. In this way, the 100 disk blocks stored in the physical file 202a are automatically mapped to the 1st to 100th data pages of the table space 1, and one disk block stored in the physical file 202b is automatically mapped to the 101st data page of the table space 1.

这样,每次在数据库重启之后,DBMS101可依据对表空间1的数据访问请求,和记录的与表空间1关联的物理文件202a、物理文件202b各自的文件大小,以及这两个文件之间的创建顺序,从而对本次数据访问请求所访问的表空间1内的逻辑的数据页,映射至磁盘的磁盘块,以实现逻辑地址向物理地址的映射,以实现对由至少两个物理文件所关联的表空间内数据的访问(这里可包括查询、删除、修改)。In this way, each time after the database is restarted, DBMS101 can map the logical data pages in table space 1 accessed by this data access request to the disk blocks of the disk based on the data access request for table space 1, the recorded file sizes of physical files 202a and physical files 202b associated with table space 1, and the creation order of the two files, so as to realize the mapping of logical addresses to physical addresses, so as to realize the access to data in the table space associated with at least two physical files (which may include query, deletion, and modification).

例如,本次数据访问请求请求访问表空间1的第2个数据页,则在物理文件202a对应的磁盘103a内映射的对应物理地址进行数据访问;再如,本次数据访问请求访问表空间1的第101个数据页,则在物理文件202b对应的磁盘103b内映射的对应物理地址进行数据访问。For example, if the data access request is to access the second data page of table space 1, data access is performed at the corresponding physical address mapped in disk 103a corresponding to physical file 202a; for another example, if the data access request is to access the 101st data page of table space 1, data access is performed at the corresponding physical address mapped in disk 103b corresponding to physical file 202b.

如果该数据访问请求为插入数据,则无需依据记录的上述文件大小和文件创建的顺序的信息,可默认插入至物理文件202b,也可以在磁盘103a空闲的情况下,插入至物理文件202a,这里不做限制。If the data access request is to insert data, it can be inserted into the physical file 202b by default without relying on the recorded file size and file creation order information, or it can be inserted into the physical file 202a when the disk 103a is idle. There is no restriction here.

在本申请实施例中,每次数据库重启后,数据库可记录关联有同一表空间的至少两个物理文件的文件大小,以及文件的创建顺序的信息。这样,在本次数据库重启之后,业务在请求对该数据库的上述表空间进行数据的删除、修改、查询等操作时,则数据库可依据记录的上述信息,将所访问的对应有至少两个物理文件的表空间内被访问的数据页的逻辑地址与物理文件202a或物理文件201b的物理地址进行映射,从而实现在不同数据目录内分别关联有至少两个物理文件的表空间的准确地数据访问。In the embodiment of the present application, after each database restart, the database can record the file sizes of at least two physical files associated with the same table space, as well as the information of the order in which the files are created. In this way, after the database is restarted, when the service requests to delete, modify, query, and perform other operations on the above table space of the database, the database can map the logical address of the accessed data page in the table space corresponding to at least two physical files with the physical address of the physical file 202a or the physical file 201b based on the above recorded information, thereby achieving accurate data access to the table spaces respectively associated with at least two physical files in different data directories.

上述过程以表空间1为例,来说明数据库重启之后的数据访问过程,在所访问的表为新表,例如图2a所示的表空间6时,则如果数据目录102a内包括物理文件6a,则这里的物理文件6b早于物理文件6a创建,其他过程均与上述表空间1所描述的数据访问过程同理,这里不做赘述。The above process takes tablespace 1 as an example to illustrate the data access process after the database is restarted. When the accessed table is a new table, such as tablespace 6 shown in Figure 2a, if the data directory 102a includes physical file 6a, then the physical file 6b here is created earlier than the physical file 6a. The other processes are the same as the data access process described in the above tablespace 1, and will not be repeated here.

在本申请各个实施例中,同一个数据目录内的多个物理文件对应的表空间不同,换言之,一个表空间的数据可以存储在多个数据目录中,但是一个表空间的数据在存储在任意一个数据目录中时,该表空间的数据只可以存储在相应数据目录的一个物理文件内。In various embodiments of the present application, multiple physical files in the same data directory correspond to different table spaces. In other words, data in a table space can be stored in multiple data directories, but when data in a table space is stored in any data directory, the data in the table space can only be stored in one physical file in the corresponding data directory.

在一种可能的实施方式中,在对上述数据库的表数据进行备份时,本申请可对备份工具进行改进,本申请的备份工具可通过读取数据库的配置文件,来获取到该数据库的数据目录的地址信息,例如图2a所示的数据目录102a的地址和数据目录102b的地址;然后,该备份工具可利用上述两个数据目录的地址,从两个数据目录进行物理文件的信息(名称、大小等)的扫描,从而确定哪些表空间在上述两个数据目录中分别关联有物理文件,以及该表空间所关联的物理文件,以及物理文件的创建顺序;然后,备份工具可从两个数据目录中的关联有同一表空间的物理文件中分别读取数据,以表空间1为例,这里备份工具可从数据目录102a的物理文件202a内读取数据,以及从数据目录102b的物理文件202b内读取数据;以及备份工具按照该物理文件的创建顺序(其中,物理文件202a早于物理文件202b创建),将从物理文件202b读取的数据,连接到从物理文件202a读取的数据的尾部,以得到表空间1的备份数据。In a possible implementation, when backing up the table data of the above-mentioned database, the present application may improve the backup tool. The backup tool of the present application may obtain the address information of the data directory of the database by reading the configuration file of the database, such as the address of the data directory 102a and the address of the data directory 102b shown in FIG. 2a; then, the backup tool may use the addresses of the above-mentioned two data directories to scan the information (name, size, etc.) of the physical files from the two data directories, so as to determine which table spaces are respectively associated with physical files in the above-mentioned two data directories, and the physical files associated with the table spaces. , and the order in which the physical files are created; then, the backup tool can read data from the physical files associated with the same tablespace in the two data directories respectively. Taking tablespace 1 as an example, the backup tool can read data from physical file 202a in data directory 102a and read data from physical file 202b in data directory 102b; and the backup tool connects the data read from physical file 202b to the end of the data read from physical file 202a according to the order in which the physical files are created (wherein physical file 202a is created earlier than physical file 202b) to obtain the backup data of tablespace 1.

继续参照图2b,例如物理文件202a内的数据按照存储从先到后的顺序,依次为磁盘块3001a、磁盘块3002a、…、磁盘块3100a存储的数据。那么如图2c所示,表空间1的备份数据,按照数据的先后顺序,依次为磁盘块3001a、磁盘块3002a、…、磁盘块3100a、磁盘块3001b存储的数据,其中,磁盘块3001b存储的数据接在磁盘块3100a的数据尾部。Continuing to refer to FIG. 2b, for example, the data in physical file 202a is stored in order from first to last, i.e., the data stored in disk block 3001a, disk block 3002a, ..., disk block 3100a. Then, as shown in FIG. 2c, the backup data of table space 1 is stored in order from first to last, i.e., the data stored in disk block 3001a, disk block 3002a, ..., disk block 3100a, disk block 3001b, wherein the data stored in disk block 3001b is connected to the end of the data in disk block 3100a.

示例性的,该备份工具可以是对已有数据库备份工具的改进,例如增加表空间文件聚合组件,以实现对关联有多个物理文件的表空间的数据备份。关于该备份工具对只关联有一个物理文件的表空间的数据的备份方式,可以采用现有的任意一种数据库的数据备份方式,这里不做限制。例如,该备份工具可为软件。Exemplarily, the backup tool may be an improvement on an existing database backup tool, such as adding a tablespace file aggregation component to implement data backup of a tablespace associated with multiple physical files. The backup tool may use any existing database data backup method for data in a tablespace associated with only one physical file, and is not limited here. For example, the backup tool may be software.

这样,本申请的数据库管理系统对于存储在多个数据目录的表,可支持全量的数据备份,并且,该数据备份操作所操作的数据库对象仍旧是表空间,不涉及具体的数据页的存储位置,能够对全量备份操作透明。In this way, the database management system of the present application can support full data backup for tables stored in multiple data directories, and the database object operated by the data backup operation is still the table space, which does not involve the storage location of specific data pages and can be transparent to the full backup operation.

在本申请实施例中,通过新增了用于存储表空间的数据的物理文件,使得表空间对应的一个表内的不同数据可分别存储在不同的物理文件,这样仅改变了表空间的底层表数据的存储位置,且位于不同存储位置的多个物理文件关联有同一表空间,使得该多个物理文件(例如物理文件1a和物理文件1b)组成了表空间1的一个逻辑的表空间对象,以此实现了对同一表空间的数据存储位置的拆分。由于数据库是以数据库对象(例如表空间,而非物理文件)为操作基础的,那么数据库的各种功能无法检测到表空间的表数据的存储位置的变化,业务也不会感知到表内数据的存储位置的变化,这样在业务访问数据库数据时,本申请的方法可实现对对应不同物理文件的表空间的数据的热切换访问,业务不感知该热切换。这样,经过存储位置拆分的表(例如图2a所示的表空间1至表空间6分别对应的表)所支持的数据库操作功能,与数据库内没有进行存储位置拆分的普通表(例如图1中的表空间1至表空间6分别对应的表)所支持的数据库操作功能可保持一致。In the embodiment of the present application, by adding a physical file for storing the data of the table space, different data in a table corresponding to the table space can be stored in different physical files respectively, so that only the storage location of the underlying table data of the table space is changed, and multiple physical files located at different storage locations are associated with the same table space, so that the multiple physical files (such as physical file 1a and physical file 1b) constitute a logical table space object of table space 1, thereby realizing the splitting of the data storage location of the same table space. Since the database is based on database objects (such as table spaces, not physical files), the various functions of the database cannot detect the change of the storage location of the table data of the table space, and the business will not perceive the change of the storage location of the data in the table. In this way, when the business accesses the database data, the method of the present application can realize the hot switching access to the data of the table space corresponding to different physical files, and the business does not perceive the hot switching. In this way, the database operation functions supported by the table split by the storage location (such as the table corresponding to table space 1 to table space 6 shown in Figure 2a) can be consistent with the database operation functions supported by the ordinary table in the database that has not been split by the storage location (such as the table corresponding to table space 1 to table space 6 in Figure 1).

图2a为示例性示出系统框架结构示意图。应该理解的是,图2a所示架构图仅是一个范例,本申请的系统可以具有比图中所示的更多的或者更少的部件,可以组合两个或多个的部件,或者可以具有不同的部件配置。图2a中所示出的各种部件可以在包括一个或多个信号处理和/或专用集成电路在内的硬件、软件、或硬件和软件的组合中实现。FIG. 2a is a schematic diagram showing an exemplary system framework structure. It should be understood that the architecture diagram shown in FIG. 2a is only an example, and the system of the present application may have more or fewer components than those shown in the figure, may combine two or more components, or may have different component configurations. The various components shown in FIG. 2a may be implemented in hardware, software, or a combination of hardware and software including one or more signal processing and/or application specific integrated circuits.

在一种可能的实施方式中,本申请还一种数据库系统的数据存储系统,所述数据库系统的数据目录包括:第一数据目录和至少一个第二数据目录,所述数据存储系统包括:第一写入模块,用于基于第一写入请求,将第一数据写入至所述第二数据目录内的第二物理文件;其中,所述第一写入请求包括请求向第一表空间写入的第一数据;所述第二物理文件与所述第一表空间相关联;所述第一表空间还与所述第一数据目录内的第一物理文件相关联;所述第一物理文件包括所述第一表空间的部分数据。In a possible implementation, the present application also provides a data storage system for a database system, wherein the data directory of the database system includes: a first data directory and at least one second data directory, and the data storage system includes: a first write module, used to write first data to a second physical file in the second data directory based on a first write request; wherein the first write request includes a request to write first data to a first table space; the second physical file is associated with the first table space; the first table space is also associated with a first physical file in the first data directory; the first physical file includes part of the data of the first table space.

在一种可能的实施方式中,所述第一写入模块,具体用于:基于第一写入请求,在确定所述第二数据目录内不包括与所述第一表空间关联的第二物理文件的情况下,在所述第二数据目录内创建与所述第一表空间关联的第二物理文件;将第一数据写入至所述第二物理文件。In a possible implementation, the first write module is specifically used to: based on the first write request, when it is determined that the second data directory does not include the second physical file associated with the first table space, create a second physical file associated with the first table space in the second data directory; and write the first data to the second physical file.

在一种可能的实施方式中,所述第一物理文件包括所述第一表空间的至少一个数据页的数据,所述第二物理文件包括所述第一表空间的至少一个数据页的数据。In a possible implementation, the first physical file includes data of at least one data page of the first table space, and the second physical file includes data of at least one data page of the first table space.

在一种可能的实施方式中,所述数据存储系统还包括:映射模块,用于基于对所述第一表空间的第一访问请求,依据所述第一物理文件的文件大小、所述第二物理文件的文件大小、所述第一物理文件与所述第二物理文件之间的创建先后顺序,将对所述第一表空间的第一访问地址,映射至第三物理文件中的第二访问地址,其中,所述第三物理文件为所述第一物理文件或所述第二物理文件,其中,所述第一访问请求包括所述第一访问地址;第一访问模块,用于按照所述第二访问地址访问所述第一表空间的数据。In a possible implementation, the data storage system further includes: a mapping module, used to map a first access address to the first table space to a second access address in a third physical file based on a first access request to the first table space, according to the file size of the first physical file, the file size of the second physical file, and the order of creation of the first physical file and the second physical file, wherein the third physical file is the first physical file or the second physical file, and wherein the first access request includes the first access address; a first access module, used to access data in the first table space according to the second access address.

在一种可能的实施方式中,所述数据存储系统还包括:第一确定模块,用于在所述数据库系统重启时,确定所述第一数据目录内和所述至少一个第二数据目录内各自的物理文件中,与同一第二表空间关联的至少两个第四物理文件;记录模块,用于记录第一信息,其中,所述第一信息包括:与所述第二表空间关联的所述至少两个第四物理文件中每个物理文件的文件大小、以及所述至少两个第四物理文件中不同所述第四物理文件之间的创建先后顺序。In a possible implementation, the data storage system further includes: a first determination module, used to determine, when the database system is restarted, at least two fourth physical files associated with the same second table space in the respective physical files in the first data directory and in the at least one second data directory; a recording module, used to record first information, wherein the first information includes: the file size of each physical file in the at least two fourth physical files associated with the second table space, and the creation order between different fourth physical files in the at least two fourth physical files.

在一种可能的实施方式中,所述数据存储系统还包括:第二访问模块,用于基于对所述第二表空间的第二访问请求,依据对所述第二表空间记录的所述第一信息,在与所述第二表空间关联的至少一个所述第四物理文件中,访问所述第二表空间的数据。In a possible implementation, the data storage system further includes: a second access module for accessing data of the second table space in at least one of the fourth physical files associated with the second table space based on a second access request to the second table space and in accordance with the first information recorded in the second table space.

在一种可能的实施方式中,所述数据存储系统还包括:第一创建模块,用于基于第二写入请求,在所述数据库系统中创建第三表空间,其中,所述第二写入请求包括请求向第三表空间写入的第二数据;第二创建模块,用于在所述第二数据目录内创建与所述第三表空间关联的第五物理文件;第二写入模块,用于将所述第二数据写入至所述第五物理文件。In a possible embodiment, the data storage system also includes: a first creation module, used to create a third table space in the database system based on a second write request, wherein the second write request includes a request to write second data to the third table space; a second creation module, used to create a fifth physical file associated with the third table space in the second data directory; and a second write module, used to write the second data to the fifth physical file.

在一种可能的实施方式中,所述数据存储系统还包括:第二确定模块,用于确定所述第一数据目录内和所述至少一个第二数据目录内各自的物理文件中,与同一第四表空间关联的至少两个第六物理文件;读取模块,用于读取所述至少两个第六物理文件内每个第六物理文件内的数据;拼接模块,用于基于所述至少两个第六物理文件中不同所述第六物理文件之间的创建先后顺序,按照创建时间从早到晚的顺序,将从所述至少两个第六物理文件分别读取的数据进行连接,以获取所述第四表空间的表数据;备份模块,用于将所述第四表空间的表数据进行备份。In a possible embodiment, the data storage system also includes: a second determination module, used to determine at least two sixth physical files associated with the same fourth table space in the respective physical files in the first data directory and the at least one second data directory; a reading module, used to read data in each of the at least two sixth physical files; a splicing module, used to connect the data read respectively from the at least two sixth physical files in order from earliest to latest in creation time based on the creation order between different sixth physical files in the at least two sixth physical files, so as to obtain the table data of the fourth table space; a backup module, used to back up the table data of the fourth table space.

在一种可能的实施方式中,所述第一物理文件在所述第二物理文件之前创建。In a possible implementation manner, the first physical file is created before the second physical file.

在一种可能的实施方式中,所述数据库系统的多个数据目录分别位于不同的文件系统。In a possible implementation, the multiple data directories of the database system are located in different file systems respectively.

在一种可能的实施方式中,所述数据库系统对应的多个所述文件系统对应的磁盘的磁盘类型不同。In a possible implementation manner, the disks corresponding to the multiple file systems corresponding to the database system are of different disk types.

下面介绍本申请实施例提供的一种装置。如图3所示:The following describes a device provided in an embodiment of the present application. As shown in FIG3:

图3为本申请实施例提供的一种数据库系统的数据存储装置的结构示意图。如图3所示,该装置500可包括:处理器501、收发器505,可选的还包括存储器502。Fig. 3 is a schematic diagram of the structure of a data storage device of a database system provided in an embodiment of the present application. As shown in Fig. 3 , the device 500 may include: a processor 501 , a transceiver 505 , and optionally a memory 502 .

所述收发器505可以称为收发单元、收发机、或收发电路等,用于实现收发功能。收发器505可以包括接收器和发送器,接收器可以称为接收机或接收电路等,用于实现接收功能;发送器可以称为发送机或发送电路等,用于实现发送功能。The transceiver 505 may be referred to as a transceiver unit, a transceiver, or a transceiver circuit, etc., and is used to implement a transceiver function. The transceiver 505 may include a receiver and a transmitter, the receiver may be referred to as a receiver or a receiving circuit, etc., and is used to implement a receiving function; the transmitter may be referred to as a transmitter or a transmitting circuit, etc., and is used to implement a transmitting function.

存储器502中可存储计算机程序或软件代码或指令504,该计算机程序或软件代码或指令504还可称为固件。处理器501可通过运行其中的计算机程序或软件代码或指令503,或通过调用存储器502中存储的计算机程序或软件代码或指令504,来实现本申请各实施例提供的数据库系统的数据存储方法。其中,处理器501可以为中央处理器(centralprocessing unit,CPU),存储器502例如可以为只读存储器(read-only memory,ROM),或为随机存取存储器(random access memory,RAM)。The memory 502 may store a computer program or software code or instruction 504, which may also be referred to as firmware. The processor 501 may implement the data storage method of the database system provided in each embodiment of the present application by running the computer program or software code or instruction 503 therein, or by calling the computer program or software code or instruction 504 stored in the memory 502. The processor 501 may be a central processing unit (CPU), and the memory 502 may be, for example, a read-only memory (ROM) or a random access memory (RAM).

本申请中描述的处理器501和收发器505可实现在集成电路(integratedcircuit,IC)、模拟IC、射频集成电路RFIC、混合信号IC、专用集成电路(applicationspecific integrated circuit,ASIC)、印刷电路板(printed circuit board,PCB)、电子设备等上。The processor 501 and transceiver 505 described in the present application can be implemented on an integrated circuit (IC), an analog IC, a radio frequency integrated circuit RFIC, a mixed signal IC, an application specific integrated circuit (ASIC), a printed circuit board (PCB), an electronic device, etc.

上述装置500还可以包括天线506,该装置500所包括的各模块仅为示例说明,本申请不对此进行限制。The above-mentioned device 500 may further include an antenna 506. The modules included in the device 500 are only for illustration and are not limited in this application.

示例性的,数据库系统的数据存储装置的结构可以不受图3的限制。数据库系统的数据存储装置可以是独立的设备或者可以是较大设备的一部分。例如所述数据库系统的数据存储装置的实现形式可以是:For example, the structure of the data storage device of the database system may not be limited by FIG. 3. The data storage device of the database system may be an independent device or may be a part of a larger device. For example, the implementation form of the data storage device of the database system may be:

(1)独立的集成电路IC,或芯片,或,芯片系统或子系统;(2)具有一个或多个IC的集合,可选的,该IC集合也可以包括用于存储数据,指令的存储部件;(3)可嵌入在其他设备内的模块;(4)车载设备等等;(5)其他等等。(1) An independent integrated circuit IC, or chip, or chip system or subsystem; (2) A collection of one or more ICs, optionally, the IC collection may also include a storage component for storing data and instructions; (3) A module that can be embedded in other devices; (4) In-vehicle equipment, etc.; (5) Others, etc.

对于数据库系统的数据存储装置的实现形式是芯片或芯片系统的情况,可参见图4所示的芯片的结构示意图。图4所示的芯片包括处理器601和接口602。其中,处理器601的数量可以是一个或多个,接口602的数量可以是多个。可选的,该芯片或芯片系统可以包括存储器603。In the case where the data storage device of the database system is implemented in the form of a chip or a chip system, reference may be made to the schematic diagram of the chip structure shown in FIG4 . The chip shown in FIG4 includes a processor 601 and an interface 602 . The number of processors 601 may be one or more, and the number of interfaces 602 may be multiple. Optionally, the chip or chip system may include a memory 603 .

其中,上述方法实施例涉及的各步骤的所有相关内容均可以援引到对应功能模块的功能描述,在此不再赘述。Among them, all relevant contents of each step involved in the above method embodiment can be referred to the functional description of the corresponding functional module, and will not be repeated here.

基于相同的技术构思,本申请实施例还提供一种计算机可读存储介质,该计算机可读存储介质存储有计算机程序,该计算机程序包含至少一段代码,该至少一段代码可由计算机执行,以控制计算机用以实现上述方法实施例。Based on the same technical concept, an embodiment of the present application also provides a computer-readable storage medium, which stores a computer program. The computer program includes at least one code segment, and the at least one code segment can be executed by a computer to control the computer to implement the above method embodiment.

基于相同的技术构思,本申请实施例还提供一种计算机程序,当该计算机程序被执行时,用以实现上述方法实施例。Based on the same technical concept, the embodiment of the present application also provides a computer program, which, when executed, is used to implement the above method embodiment.

所述程序可以全部或者部分存储在与处理器封装在一起的存储介质上,也可以部分或者全部存储在不与处理器封装在一起的存储器上。The program may be stored in whole or in part on a storage medium packaged together with the processor, or may be stored in whole or in part on a memory not packaged together with the processor.

基于相同的技术构思,本申请实施例还提供一种芯片,包括处理器。处理器可实现上述方法实施例。Based on the same technical concept, the embodiment of the present application further provides a chip, including a processor. The processor can implement the above method embodiment.

结合本申请实施例公开内容所描述的方法或者算法的步骤可以硬件的方式来实现,也可以是由处理器执行软件指令的方式来实现。软件指令可以由相应的软件模块组成,软件模块可以被存放于随机存取存储器(Random Access Memory,RAM)、闪存、只读存储器(Read Only Memory,ROM)、可擦除可编程只读存储器(Erasable Programmable ROM,EPROM)、电可擦可编程只读存储器(Electrically EPROM,EEPROM)、寄存器、硬盘、移动硬盘、只读光盘(CD-ROM)或者本领域熟知的任何其它形式的存储介质中。一种示例性的存储介质耦合至处理器,从而使处理器能够从该存储介质读取信息,且可向该存储介质写入信息。当然,存储介质也可以是处理器的组成部分。处理器和存储介质可以位于ASIC中。The steps of the method or algorithm described in conjunction with the disclosure of the embodiments of the present application can be implemented in a hardware manner, or can be implemented by a processor executing a software instruction. The software instruction can be composed of corresponding software modules, and the software module can be stored in a random access memory (Random Access Memory, RAM), a flash memory, a read-only memory (Read Only Memory, ROM), an erasable programmable read-only memory (Erasable Programmable ROM, EPROM), an electrically erasable programmable read-only memory (Electrically EPROM, EEPROM), a register, a hard disk, a mobile hard disk, a read-only compact disk (CD-ROM) or any other form of storage medium known in the art. An exemplary storage medium is coupled to a processor so that the processor can read information from the storage medium and can 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.

本领域技术人员应该可以意识到,在上述一个或多个示例中,本申请实施例所描述的功能可以用硬件、软件、固件或它们的任意组合来实现。当使用软件实现时,可以将这些功能存储在计算机可读介质中或者作为计算机可读介质上的一个或多个指令或代码进行传输。计算机可读介质包括计算机存储介质和通信介质,其中通信介质包括便于从一个地方向另一个地方传送计算机程序的任何介质。存储介质可以是通用或专用计算机能够存取的任何可用介质。Those skilled in the art should be aware that in one or more of the above examples, the functions described in the embodiments of the present application can be implemented with hardware, software, firmware, or any combination thereof. When implemented using software, these functions can be stored in a computer-readable medium or transmitted as one or more instructions or codes on a computer-readable medium. Computer-readable media include computer storage media and communication media, wherein the communication media include any media that facilitates the transmission of a computer program from one place to another. The storage medium can be any available medium that a general or special-purpose computer can access.

上面结合附图对本申请的实施例进行了描述,但是本申请并不局限于上述的具体实施方式,上述的具体实施方式仅仅是示意性的,而不是限制性的,本领域的普通技术人员在本申请的启示下,在不脱离本申请宗旨和权利要求所保护的范围情况下,还可做出很多形式,均属于本申请的保护之内。The embodiments of the present application are described above in conjunction with the accompanying drawings, but the present application is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the guidance of the present application, ordinary technicians in this field can also make many forms without departing from the purpose of the present application and the scope of protection of the claims, all of which are within the protection of the present application.

Claims (15)

1.一种数据库系统的数据存储方法,其特征在于,所述数据库系统的数据目录包括:第一数据目录和至少一个第二数据目录,所述方法包括:1. A data storage method for a database system, characterized in that the data directory of the database system includes: a first data directory and at least one second data directory, and the method includes: 基于第一写入请求,将第一数据写入至所述第二数据目录内的第二物理文件;Based on the first write request, write the first data to a second physical file in the second data directory; 其中,所述第一写入请求包括请求向第一表空间写入的第一数据;Wherein, the first write request includes a request to write first data to the first table space; 所述第二物理文件与所述第一表空间相关联;The second physical file is associated with the first table space; 所述第一表空间还与所述第一数据目录内的第一物理文件相关联;The first table space is also associated with a first physical file in the first data directory; 所述第一物理文件包括所述第一表空间的部分数据。The first physical file includes part of the data of the first table space. 2.根据权利要求1所述的方法,其特征在于,所述基于第一写入请求,将第一数据写入至所述第二数据目录内的第二物理文件,包括:2. The method according to claim 1, wherein writing the first data to the second physical file in the second data directory based on the first write request comprises: 基于第一写入请求,在确定所述第二数据目录内不包括与所述第一表空间关联的第二物理文件的情况下,在所述第二数据目录内创建与所述第一表空间关联的第二物理文件;Based on the first write request, when it is determined that the second data directory does not include a second physical file associated with the first table space, creating a second physical file associated with the first table space in the second data directory; 将第一数据写入至所述第二物理文件。The first data is written to the second physical file. 3.根据权利要求1或2所述的方法,其特征在于,所述第一物理文件包括所述第一表空间的至少一个数据页的数据,所述第二物理文件包括所述第一表空间的至少一个数据页的数据。3. The method according to claim 1 or 2, characterized in that the first physical file includes data of at least one data page of the first table space, and the second physical file includes data of at least one data page of the first table space. 4.根据权利要求1至3中任意一项所述的方法,其特征在于,所述将第一数据写入至所述第二数据目录内的第二物理文件之后,所述方法还包括:4. The method according to any one of claims 1 to 3, characterized in that after writing the first data to the second physical file in the second data directory, the method further comprises: 基于对所述第一表空间的第一访问请求,依据所述第一物理文件的文件大小、所述第二物理文件的文件大小、所述第一物理文件与所述第二物理文件之间的创建先后顺序,将对所述第一表空间的第一访问地址,映射至第三物理文件中的第二访问地址,其中,所述第三物理文件为所述第一物理文件或所述第二物理文件,其中,所述第一访问请求包括所述第一访问地址;Based on a first access request to the first tablespace, according to a file size of the first physical file, a file size of the second physical file, and a creation order of the first physical file and the second physical file, mapping a first access address to the first tablespace to a second access address in a third physical file, wherein the third physical file is the first physical file or the second physical file, and wherein the first access request includes the first access address; 按照所述第二访问地址访问所述第一表空间的数据。Access the data in the first table space according to the second access address. 5.根据权利要求1至4中任意一项所述的方法,其特征在于,所述方法还包括:5. The method according to any one of claims 1 to 4, characterized in that the method further comprises: 在所述数据库系统重启时,确定所述第一数据目录内和所述至少一个第二数据目录内各自的物理文件中,与同一第二表空间关联的至少两个第四物理文件;When the database system is restarted, determining at least two fourth physical files associated with the same second table space in the respective physical files in the first data directory and the at least one second data directory; 记录第一信息,其中,所述第一信息包括:与所述第二表空间关联的所述至少两个第四物理文件中每个物理文件的文件大小、以及所述至少两个第四物理文件中不同所述第四物理文件之间的创建先后顺序。Record first information, wherein the first information includes: the file size of each physical file in the at least two fourth physical files associated with the second table space, and the creation order between different fourth physical files in the at least two fourth physical files. 6.根据权利要求5所述的方法,其特征在于,所述记录第一信息之后,所述方法还包括:6. The method according to claim 5, characterized in that after recording the first information, the method further comprises: 基于对所述第二表空间的第二访问请求,依据对所述第二表空间记录的所述第一信息,在与所述第二表空间关联的至少一个所述第四物理文件中,访问所述第二表空间的数据。Based on a second access request to the second table space, data of the second table space is accessed in at least one of the fourth physical files associated with the second table space according to the first information recorded for the second table space. 7.根据权利要求1至6中任意一项所述的方法,其特征在于,所述方法还包括:7. The method according to any one of claims 1 to 6, characterized in that the method further comprises: 基于第二写入请求,在所述数据库系统中创建第三表空间,其中,所述第二写入请求包括请求向第三表空间写入的第二数据;Based on the second write request, creating a third table space in the database system, wherein the second write request includes second data requested to be written to the third table space; 在所述第二数据目录内创建与所述第三表空间关联的第五物理文件;Creating a fifth physical file associated with the third tablespace in the second data directory; 将所述第二数据写入至所述第五物理文件。The second data is written to the fifth physical file. 8.根据权利要求1至7中任意一项所述的方法,其特征在于,所述方法还包括:8. The method according to any one of claims 1 to 7, characterized in that the method further comprises: 确定所述第一数据目录内和所述至少一个第二数据目录内各自的物理文件中,与同一第四表空间关联的至少两个第六物理文件;Determine at least two sixth physical files associated with the same fourth table space in the respective physical files in the first data directory and the at least one second data directory; 读取所述至少两个第六物理文件内每个第六物理文件内的数据;Reading data in each sixth physical file in the at least two sixth physical files; 基于所述至少两个第六物理文件中不同所述第六物理文件之间的创建先后顺序,按照创建时间从早到晚的顺序,将从所述至少两个第六物理文件分别读取的数据进行连接,以获取所述第四表空间的表数据;Based on the creation sequence between different sixth physical files in the at least two sixth physical files, data read from the at least two sixth physical files are connected in order of creation time from earliest to latest, so as to obtain table data of the fourth table space; 将所述第四表空间的表数据进行备份。Back up the table data in the fourth table space. 9.根据权利要求1至8中任意一项所述的方法,其特征在于,所述第一物理文件在所述第二物理文件之前创建。9. The method according to any one of claims 1 to 8, characterized in that the first physical file is created before the second physical file. 10.根据权利要求1至9中任意一项所述的方法,其特征在于,所述数据库系统的多个数据目录分别位于不同的文件系统。10. The method according to any one of claims 1 to 9, characterized in that the multiple data directories of the database system are located in different file systems respectively. 11.根据权利要求9所述的方法,其特征在于,所述数据库系统对应的多个所述文件系统对应的磁盘的磁盘类型不同。11. The method according to claim 9, characterized in that the disks corresponding to the multiple file systems corresponding to the database system are of different disk types. 12.一种数据库系统的数据存储系统,其特征在于,所述数据库系统的数据目录包括:第一数据目录和至少一个第二数据目录,所述数据存储系统包括:12. A data storage system of a database system, characterized in that the data directory of the database system comprises: a first data directory and at least one second data directory, and the data storage system comprises: 第一写入模块,用于基于第一写入请求,将第一数据写入至所述第二数据目录内的第二物理文件;A first writing module, configured to write the first data into a second physical file in the second data directory based on a first writing request; 其中,所述第一写入请求包括请求向第一表空间写入的第一数据;Wherein, the first write request includes a request to write first data to the first table space; 所述第二物理文件与所述第一表空间相关联;The second physical file is associated with the first table space; 所述第一表空间还与所述第一数据目录内的第一物理文件相关联;The first table space is also associated with a first physical file in the first data directory; 所述第一物理文件包括所述第一表空间的部分数据。The first physical file includes part of the data of the first table space. 13.一种计算机可读存储介质,其特征在于,包括计算机程序,当所述计算机程序运行在计算机或处理器上时,使得所述计算机或所述处理器执行如权利要求1至11中任意一项所述的方法。13. A computer-readable storage medium, characterized in that it comprises a computer program, and when the computer program runs on a computer or a processor, the computer or the processor executes the method according to any one of claims 1 to 11. 14.一种数据库系统的数据存储装置,其特征在于,包括一个或多个接口电路和一个或多个处理器;所述接口电路用于从存储器接收信号,并向所述处理器发送所述信号,所述信号包括存储器中存储的计算机指令;当所述处理器执行所述计算机指令时,所述处理器用于执行如权利要求1至11中任意一项所述的方法。14. A data storage device for a database system, characterized in that it comprises one or more interface circuits and one or more processors; the interface circuit is used to receive a signal from a memory and send the signal to the processor, the signal comprising a computer instruction stored in the memory; when the processor executes the computer instruction, the processor is used to execute the method as described in any one of claims 1 to 11. 15.一种计算机程序产品,其特征在于,所述计算机程序产品包括软件程序,当所述软件程序被计算机或处理器执行时,使得权利要求1至11任一项所述的方法的步骤被执行。15. A computer program product, characterized in that the computer program product comprises a software program, and when the software program is executed by a computer or a processor, the steps of the method according to any one of claims 1 to 11 are executed.
CN202211397508.0A 2022-11-09 2022-11-09 Data storage method and system of database system Pending CN118051642A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211397508.0A CN118051642A (en) 2022-11-09 2022-11-09 Data storage method and system of database system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211397508.0A CN118051642A (en) 2022-11-09 2022-11-09 Data storage method and system of database system

Publications (1)

Publication Number Publication Date
CN118051642A true CN118051642A (en) 2024-05-17

Family

ID=91047042

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211397508.0A Pending CN118051642A (en) 2022-11-09 2022-11-09 Data storage method and system of database system

Country Status (1)

Country Link
CN (1) CN118051642A (en)

Similar Documents

Publication Publication Date Title
US10430286B2 (en) Storage control device and storage system
US7293131B2 (en) Access to disk storage using file attribute information
CN108628542B (en) A file merging method and controller
CN113853778B (en) Cloning method and device of file system
CN108733306B (en) A file merging method and device
WO2024183559A1 (en) Data sharing method and system, and device and storage medium
CN115794669A (en) Method, device and related equipment for expanding memory
US9430492B1 (en) Efficient scavenging of data and metadata file system blocks
US20240283463A1 (en) Data compression method and apparatus
US20200409915A1 (en) Database key compression
EP3436973A1 (en) File system support for file-level ghosting
CN110147203A (en) A file management method, device, electronic device and storage medium
CN114610680A (en) Method, device and equipment for managing metadata of distributed file system and storage medium
CN119669167B (en) File observation method, electronic device, chip and program product
US20250165152A1 (en) File System-Based Metadata Management Method and Related Device Thereof
US8769196B1 (en) Configuring I/O cache
US11366609B2 (en) Technique for encoding deferred reference count increments and decrements
US11016884B2 (en) Virtual block redirection clean-up
CN108804571B (en) Data storage method, device and equipment
CN106528830A (en) Method and device for recovering file index catalogue
WO2020024933A1 (en) Data writing method and server
US11586353B2 (en) Optimized access to high-speed storage device
CN118963644A (en) Data processing method, device, equipment and storage medium
CN118227231A (en) Partition management method, device, terminal equipment and readable storage medium
US20200311030A1 (en) Optimizing file system defrag for deduplicated block storage

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication