Metadata management method and device
By storing and managing metadata in the database, using transaction mechanisms and multi-version records, it solves the problems of data consistency and access performance in traditional big data table formats in concurrent scenarios, and achieves efficient metadata management.
Patent Information
- Application Number
- CN202310231735.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-03-10
- Publication Date
- 2024-09-17
AI Technical Summary
The traditional big data table format cannot guarantee data consistency in concurrent scenarios, has low metadata access performance, and relies on the file system, resulting in high overhead.
The metadata management method is adopted to store metadata in the database in the form of tables. The transaction mechanism is used to ensure data consistency in concurrent scenarios, and multi-version record modification records of data tables are used to improve the access speed and performance of metadata.
It achieves data consistency management in concurrent scenarios, improves metadata access speed and performance, and reduces metadata access overhead.
Smart Images

Figure CN118656368A
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of IT technology, and in particular to a metadata management method and device. Background Art
[0002] Traditional big data tables are not transactional and cannot guarantee data consistency in concurrent scenarios (such as read-write, write-write, etc.). Summary of the invention
[0003] In order to solve the above technical problems, the present application provides a metadata management method and device. In this method, the metadata table of big data can be transactional and can ensure the consistency of its own data in concurrent scenarios.
[0004] In a possible implementation, the present application provides a metadata management method, which is applied to computing nodes in a data center. The method includes: at the beginning of a first transaction, determining the source version number of the first transaction, wherein the first transaction is used to perform at least one write operation on at least one first data table in a data lake; wherein the source version number is used to indicate the latest version number associated with each of the first data tables stored in a first metadata table in a database management system; wherein the first metadata table includes a version number assigned to a second transaction and modification record information of a data file associated with the second transaction, wherein the second transaction is used to operate a data file of a data table in the data lake, and the second transaction is a transaction that has been successfully submitted; obtaining first modification record information of the data file associated with each of the write operations; when the first transaction is submitted, assigning a first version number to the first transaction, determining that there is no second modification record information in the first metadata table whose version number is between the source version number and the first version number, wherein the second modification record information is modification record information of a data file that deletes or modifies the same data file as the first modification record information; and writing the first version number and the first modification record information to the first metadata table in association.
[0005] The first transaction may be a single-table transaction or a multi-table transaction. A single-table transaction is used to indicate that an operation is performed on a data table (represented by the first data table) within the transaction, and a multi-table transaction is used to indicate that an operation may be performed on multiple data tables (represented by the first data table) within the transaction. For example, the multiple data tables belong to the same catalog object (catalog).
[0006] The first data table operated by the first transaction may be one or more first data tables, and the first transaction may perform one or more write operations on any first data table.
[0007] The write operation may be at least one of inserting records into the data table (corresponding to an insert operation), modifying records in the data table (corresponding to an update operation), and deleting records in the data table (corresponding to a delete operation).
[0008] The first metadata table may be a metadata table of a single first data table, or may be a metadata table of a directory object (eg, catalog 1) to which at least one first data table operated by the first transaction belongs.
[0009] In a single-table transaction, the source version number can be used to identify the version number corresponding to the latest modification record of the data file of the first data table in the first metadata table of the first data table when the write operation is performed on the first data table. In other words, the source version number is used to indicate which modified version of the first data table the write operation is based on.
[0010] For example Figure 2d The source version number of transaction 1 shown may be V1.
[0011] In a multi-table transaction, the source version number may be the latest version number in the first metadata table of the catalog object (catalog1) to which one or more first data tables belong.
[0012] For example Figure 4 The source version number of the multi-table transaction 1 shown is V5, which is the latest version number in the metadata table based on catalog log 1 when the multi-table transaction 1 starts (for example Figure 4 The version number generated by incrementing V4) as shown.
[0013] V5 can be used to indicate the latest version number of each data table in catalog log1: the version number in the metadata table of catalog log1 is less than V5 and the latest version number related to each data table.
[0014] The operation performed by the second transaction on the data files of the data table in the data lake may be a write operation on the data table to add or delete related data files, or may be a merge operation on the data files of the data table.
[0015] When the first transaction is committed, the computing node may assign a first version number to the first transaction. The first version number may be a version number obtained by incrementing the latest version number in the metadata table of catalog 1 to which the first data table belongs.
[0016] In addition, when the first transaction is committed, when the write operation performed by the first transaction on the first data table includes an update operation and / or a delete operation, the computing node can combine the source version number and the first version number of the first transaction to make a transaction conflict judgment on the first transaction to determine whether there is a deletion or modification of the same data file in the modification record information of the data file with a version number between the source version number and the first version number in the first metadata table and between the modification record information of the data file of the first transaction; if there is a deletion or modification of the same data file, it means that before the first transaction is committed, there is a transaction that is parallel to the first transaction and is successfully committed, and the parallel transaction and the first transaction involve the deletion or modification of the same data file, then in order to ensure data consistency in concurrent scenarios, the first transaction fails to commit and needs to be rolled back. On the contrary, if there is no deletion or modification of the same data file between concurrent transactions, the computing node can write the first version number and the first modification record information of the data file into the first metadata table in association, so as to realize the update synchronization of the metadata information of the data table after the data table write operation.
[0017] For example, the computing node may write the first version number and the first modification record information in association with each other into the metadata table of the first data table operated by the first transaction, and write the first version number and the first modification record information in association with each other into the metadata table of catalog 1 to which the first data table belongs.
[0018] Optionally, when the write operation performed by the first transaction on the first data table is an insert operation, since the insert operation only adds data files related to the first data table but does not delete data records related to the first data table, transaction conflict judgment may not be performed on the first transaction.
[0019] The present application stores the metadata information of the data table in the database in the form of a table (i.e., a metadata table), and accesses the metadata of the data table in the form of accessing a table in the database, which can improve the access speed to the metadata and improve performance. In addition, the present application stores each modification of the data table in the form of a version number and a modification record of its data file in the metadata table, that is, records the addition, modification, and deletion of the data records of the data table in a multi-version manner (corresponding to the addition and deletion of the data file), so that each modification of the data table can be recorded in the metadata table, and the organizational structure of the metadata information is different from the organizational structure of the metadata of the data table in the prior art. In addition, when the computing node writes the above-mentioned modification record to the metadata table, it can perform data file-level conflict detection between the current transaction and other parallel submitted transactions, so that as long as there are other submitted transactions that modify or delete the same data file during the execution of the current transaction, it means that there is a transaction that conflicts with the current transaction, and the current transaction fails to commit. To ensure that the metadata operation is isolated, to solve the data consistency problem in concurrent scenarios, and to make the access to metadata transactional.
[0020] In a possible implementation, the method further includes: at the start of the first transaction, determining the parent object of the at least one first data table, and creating a snapshot object of the parent object; wherein the attribute information of the snapshot object includes information for identifying the parent object and the source version number; wherein the source version number is the version number assigned to the first transaction at the start of the first transaction; and the first metadata table is used to store modification record information of data files related to the parent object.
[0021] Wherein, whether the first transaction is a single-table transaction or a multi-table transaction, the method of this implementation mode can be used to implement metadata management, and the first transaction is a multi-table transaction as an example for explanation.
[0022] The parent object may be a directory object (eg, cata log) or a database object (eg, database).
[0023] Taking catalog log1 as the parent object as an example, the computing node can create a snapshot object of catalog log1, which is also a directory object, named catalog log1-1 here, wherein the attributes of catalog log1-1 may include information for indicating catalog log1 and the source version number of the first transaction.
[0024] The source version number assigned to the computing node at the beginning of the first transaction may be a version number obtained by incrementing the version number based on the latest version number in the metadata table of catalog log1.
[0025] The first metadata table here may be the metadata table of catalog 1.
[0026] In an embodiment of the present application, in order to implement multi-table transactions, the present application can create a snapshot object of the parent object of the data table to implement a reference to the metadata in the metadata table of the parent object before the start of the multi-table transaction, without copying the metadata information in the metadata table before the start of the multi-table transaction, because the snapshot object records the source version number, and the source version number can express the modification basis of the multi-table transaction on any data table under the parent object, so that the multi-table transaction can perform write operations and read operations on all data tables under the parent object, and can realize multi-table data isolation and realize multi-table transactions.
[0027] In a possible implementation, the method further includes: during execution of the first transaction, writing first modification record information of the data file associated with each write operation into a second metadata table within the database management system; wherein the second metadata table is used to store modification record information of the data file associated with the snapshot object.
[0028] Among them, the method of creating a multi-table transaction can be implemented by creating a snapshot object catalog log1-1 of catalog log1, so the computing node can also create a metadata table corresponding to catalog log1-1 (such as the above-mentioned second metadata table) in the database management system. Then, during the execution of the first transaction, the modification record information of the data file generated by the first transaction performing a write operation on any data table under catalog log1 can be recorded by the computing node in the metadata table of catalog log1-1.
[0029] Optionally, during the execution of the first transaction, after the computing node completes each write operation to the data table, when performing a write commit operation (such as calling the writeCommit interface), the computing node may assign a sub-version number, or an identifier (ID) or other field to the write operation to distinguish the modification record information of the data files generated by different write operations in the metadata table of catalog 1-1.
[0030] In addition, in this embodiment, when the first transaction is submitted (at this time, the computing node assigns the first version number to the first transaction), when the computing node performs transaction conflict judgment on the first transaction, the modification record information of the data file in the second metadata table can be used to perform data file-level conflict detection with the modification record information of the data file whose version number is between the source version number and the first version number in the metadata table of catalog 1 (here, the first metadata table). As long as there is modification record information of modification or deletion of the same data file, it indicates a transaction conflict and the first transaction fails to be submitted. Otherwise, the first transaction is successfully submitted. The specific process of transaction conflict detection can be referred to the introduction of the above embodiment, and the principle is similar, so it will not be repeated here.
[0031] In an embodiment of the present application, in a multi-table transaction, when performing transaction conflict detection, a data file-level conflict detection may be performed on the modification record information of the data file whose version number is between the source version number and the first version number in the first metadata table of the parent object (e.g., catalog 1) referenced by the multi-table transaction, so as to determine whether there is a conflict between the deletion or modification of the same data file by a parallel committed transaction during the execution of the multi-table transaction, so as to ensure the isolation of the multi-table transaction.
[0032] In a possible implementation, writing the first version number and the first modification record information into the first metadata table in association includes: writing the first version number and the first modification record information stored in the second metadata table into the first metadata table in association.
[0033] For example, in a scenario where the first transaction is created by creating a snapshot, for example, the first transaction is a multi-table transaction, when it is determined that the first transaction does not have a transaction conflict with other committed transactions, the computing node may write the first version number assigned to the first transaction and the modification record information of the data file in the metadata table of catalog log1-1 (for example, it may be multiple FileGroup groups generated by multiple write operations) into the metadata table of catalog log1 to ensure the integrity of the metadata table of catalog log1.
[0034] In a possible implementation, the first transaction is also used to perform a read operation on the first data table, and the method further includes: during the execution of the first transaction, querying the second metadata table for third modification record information of data files related to the first data table, and querying the first metadata table for fourth modification record information of data files whose version numbers are less than the source version number and are related to the first data table; and determining a first data file list related to the first data table based on the third modification record information and the fourth modification record information.
[0035] The first transaction may also perform a read operation (corresponding to a select operation) on one or more first data tables.
[0036] For example, the first data table read by the first transaction is data table 1 in catalog log1. However, when the first transaction writes to the data table, it may write to one or more data tables in catalog log1. The first transaction may write to data table 1, so that the modification record information in the second metadata table may include modification record information of data files related to data table 1 (named as third modification record information here). It is also possible that the first transaction does not write to data table 1, so that the modification record information in the second metadata table (the above-mentioned first modification record information) does not include the third modification record information of data files related to data table 1.
[0037] Then, regardless of whether the first transaction includes modification record information related to data table 1, when the first transaction performs record query on data table 1, the computing node not only needs to query the modification record information (here named as the third modification record information) of the data files related to data table 1 in the metadata table of catalog log1-1 (here the second data table), wherein if the modification record information of the data files related to data table 1 does not exist in the metadata table of catalog log1-1, the queried third modification record information is empty. In addition, the computing node also needs to query the modification record information (here named as the fourth modification record information) of the data files related to data table 1 whose version number is less than the source version number of the first transaction in the metadata table of catalog log1 (here the first data table). Then the computing node can combine the third modification record information and the fourth modification record information to determine the list of data files related to data table 1.
[0038] Among them, the process of the computing node obtaining a list of data files related to data table 1 (for example, it may involve the merging of modification record information of data files) may be related to the writing method (MOR or COW) of the computing node when performing data table write operations, and is not restricted here.
[0039] In an embodiment of the present application, when querying data of a data table in a first transaction (for example, a multi-table transaction), it is necessary to determine a list of data files related to the data table. In order to determine the list of data files related to the data table, the first transaction not only needs to combine the modification record information about the data files of the data table in the metadata table of the snapshot object of the first transaction, but also needs to combine the modification record information of the data files related to the data table whose version number is before the source version number of the first transaction in the metadata table of the parent object of the snapshot object, so as to ensure the complete acquisition of the data list of the data table in the transaction, so as to realize accurate data access to the data table in the transaction and improve the access efficiency of the data table.
[0040] In a possible implementation, the first transaction is also used to perform a read operation on the first data table, and the method further includes: during the execution of the first transaction, when it is determined that modification record information of data files related to the first data table is not found in the second metadata table, querying the first metadata table for fourth modification record information of data files with a version number less than the source version number and related to the first data table; based on the fourth modification record information, obtaining a second data file list related to the first data table.
[0041] Among them, this implementation also reads the data of data table 1 in the first transaction. The only difference from the previous implementation is that there is no modification record information of the data files related to data table 1 in the second metadata table of the snapshot object of the first transaction. The computing node only needs to refer to the modification record information of the data files related to data table 1 in the first metadata table of the parent object of the snapshot object, whose version number is less than the source version number of the first transaction, to obtain a list of data files related to data table 1.
[0042] The first data file list is different from the second data file list here.
[0043] In a possible implementation manner, before determining that there is no second modification record information with a version number between the source version number and the first version number in the first metadata table, the method further includes: locking the first metadata table.
[0044] Among them, when the second transaction is committed, the computing node can assign a first version number to the second transaction and perform transaction conflict detection on it. During the transaction conflict detection, the computing node can first lock the first metadata table to prevent other transactions from writing data to the first metadata table during the transaction conflict detection of the first transaction, thereby ensuring the accuracy of the transaction conflict detection.
[0045] For example, when the first transaction is a single-table transaction and the transaction is not created by creating a snapshot object, the computing node may lock the metadata table of the first data table on which the first transaction performs a write operation. Optionally, the computing node may further lock the records related to the first data table in the metadata table of the parent object (catalog 1) to which the first data table belongs.
[0046] For another example, if the first transaction is a transaction created by creating a snapshot object, such as a multi-table transaction (or a multi-table transaction), the computing node can lock the metadata table of the parent object of the snapshot object (such as catalog log1). In this way, in combination with the mutual exclusion capability of the database, during the period when the computing node performs transaction conflict judgment on the first transaction, other transactions cannot continue to write data to the metadata table of catalog log1, so as to ensure the accuracy of the transaction conflict judgment on the first transaction.
[0047] In a possible implementation, the method further includes: when the first transaction is committed, obtaining data statistical information of data files respectively related to each of the first data tables; and writing the data statistical information into a third metadata table related to the first data table in the database management system.
[0048] For example, the data statistics information of a data file may be partition information, the maximum value and the minimum value of a data column in the data file, etc., which are not limited here.
[0049] The metadata table (here the third data table) of the embodiment of the present application can record the statistical information of the partition and the statistical information of the data file, and can push the filtering of the data file down to the database to improve the access speed of the metadata.
[0050] In a possible implementation, the method further includes: during the execution of the third transaction, based on a filtering condition, querying the first metadata table and the third metadata table to obtain a list of third data files related to the first data table that meet the filtering condition; wherein the third transaction is used to perform a read operation on the first data table, and the read operation includes the filtering condition for the data records to be read.
[0051] For example, the filter condition can be an expression.
[0052] The embodiment of the present application can use the statistical information stored in the third metadata table, combined with the first metadata table, to query the list of data files that meet the screening condition, which can filter the data files and push the screening of data files down to the database, thereby improving the access speed of metadata. This process can also be applied to the process of reading the data table of multi-table transactions, where the third transaction can be a single-table transaction or a multi-table transaction.
[0053] In a possible implementation, the present application provides a metadata management device. The device includes: a first determination module, used to determine the source version number of the first transaction at the beginning of a first transaction, wherein the first transaction is used to perform at least one write operation on at least one first data table in a data lake; wherein the source version number is used to indicate the latest version number associated with each first data table stored in a first metadata table in a database management system; wherein the first metadata table includes a version number assigned to a second transaction and modification record information of a data file associated with the second transaction, wherein the second transaction is used to operate a data file of a data table in the data lake, and the second transaction is a transaction that has been successfully submitted; a first acquisition module, used to obtain first modification record information of a data file associated with each write operation; a second determination module, used to assign a first version number to the first transaction when the first transaction is submitted, and determine that there is no second modification record information in the first metadata table with a version number between the source version number and the first version number, wherein the second modification record information is modification record information of a data file that deletes or modifies the same data file as the first modification record information; a first writing module, used to write the first version number and the first modification record information into the first metadata table in association.
[0054] In a possible implementation, the device also includes: a third determination module, used to determine the parent object of the at least one first data table and create a snapshot object of the parent object when the first transaction starts; wherein the attribute information of the snapshot object includes information for identifying the parent object and the source version number; wherein the source version number is the version number assigned to the first transaction when the first transaction starts; and the first metadata table is used to store modification record information of data files related to the parent object.
[0055] In a possible implementation, the device further includes: a second writing module, used to write first modification record information of the data file associated with each write operation to a second metadata table in the database management system during the execution of the first transaction; wherein the second metadata table is used to store modification record information of the data file associated with the snapshot object.
[0056] In a possible implementation, the first writing module is specifically configured to write the first version number and the first modification record information stored in the second metadata table into the first metadata table in association with each other.
[0057] In a possible implementation, the device further includes: a first query module, used to query the second metadata table for third modification record information of data files related to the first data table during execution of the first transaction, and to query the first metadata table for fourth modification record information of data files whose version numbers are less than the source version number and are related to the first data table, wherein the first transaction is also used to perform a read operation on the first data table; and a fourth determination module, used to determine a first data file list related to the first data table based on the third modification record information and the fourth modification record information.
[0058] In a possible implementation, the device further includes: a fifth determination module, which is used to, during the execution of the first transaction, when it is determined that no modification record information of the data file related to the first data table is found in the second metadata table, query the first metadata table for fourth modification record information of the data file whose version number is less than the source version number and is related to the first data table, wherein the first transaction is also used to perform a read operation on the first data table; and a second acquisition module, which is used to acquire a second data file list related to the first data table based on the fourth modification record information.
[0059] In a possible implementation manner, the device further includes: a locking module, configured to lock the first metadata table.
[0060] In a possible implementation, the device also includes: a third acquisition module, used to obtain data statistical information of data files respectively related to each of the first data tables when the first transaction is committed; a third writing module, used to write the data statistical information into a third metadata table related to the first data table in the database management system.
[0061] In a possible implementation, the device further includes: a second query module, used to query the first metadata table and the third metadata table based on a filtering condition during the execution of the third transaction, and obtain a list of third data files related to the first data table that meet the filtering condition; wherein the third transaction is used to perform a read operation on the first data table, and the read operation includes the filtering condition for the data records to be read.
[0062] The effects of the metadata management apparatus of each of the above embodiments are similar to the effects of the metadata management method of each of the above embodiments, and will not be described in detail here.
[0063] In a possible implementation, the present application provides a metadata management device. The metadata management device 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.
[0064] The effects of the metadata management device of this embodiment are similar to the effects of the metadata management methods of the above-mentioned embodiments, and will not be described in detail here.
[0065] 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.
[0066] The effect of the computer-readable storage medium of this embodiment is similar to the effect of the metadata management method of the above-mentioned embodiments, and will not be described in detail here.
[0067] 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.
[0068] The effect of the computer program product of this embodiment is similar to the effect of the metadata management method of the above-mentioned embodiments, and will not be described in detail here. BRIEF DESCRIPTION OF THE DRAWINGS
[0069] 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 creative labor.
[0070] Figure 1a is a schematic diagram of an exemplary system framework;
[0071] Figure 1b is a schematic diagram of an exemplary system framework;
[0072] Figure 2a is a schematic diagram of a data processing process shown as an example;
[0073] Figure 2b A schematic diagram of data changes for exemplary data writing;
[0074] Figure 2c A schematic diagram of data changes for exemplary data writing;
[0075] Figure 2d is a schematic diagram of an application scenario shown as an example;
[0076] Figure 2e is a schematic diagram of an application scenario shown as an example;
[0077] Figure 3 is a schematic diagram of a data processing process shown as an example;
[0078] Figure 4 The following is a schematic diagram of an application scenario of a multi-table transaction shown as an example;
[0079] Figure 5 A schematic diagram of the structure of a device provided in an embodiment of the present application;
[0080] Figure 6 A schematic diagram of the structure of a chip provided in an embodiment of the present application. DETAILED DESCRIPTION
[0081] 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.
[0082] 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.
[0083] 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.
[0084] 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.
[0085] 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.
[0086] Before introducing the embodiments of the present application, some technical terms involved in the present application are first explained and defined:
[0087] Data lake: is a system or storage that stores data in its natural / original format, usually as object blocks or files, including raw data copies generated by the original system and transformed data generated for various tasks, including structured data (rows and columns) from relational databases, semi-structured data (such as CSV, logs, XML, JSON), and unstructured data (such as emails, documents, PDFs, images, audio, and video).
[0088] Data Lake Table Format: The table format defines the organization of data and metadata, and provides unified "table" semantics. It is built on the data storage format, and its underlying data storage is still stored using Parquet, ORC, etc. It is positioned below the computing engine and above the storage, and is called a table format. Among them, the organization of the table is called the table format.
[0089] Parquet: Apache Parquet is a columnar storage format for analytical services. Parquet is a language-independent columnar storage file type that can be adapted to a variety of computing frameworks.
[0090] Transaction: refers to a set of data table operations, a sequence of database operations that access and possibly operate various data items. These operations are either all executed or not executed at all, and are an indivisible unit of work. In computer terms, it refers to a program execution unit (unit) that accesses and possibly updates various data items in a data table in a database. A transaction consists of all data table operations executed between the start and end of a transaction. In a relational database, a transaction can be a SQL statement, a set of SQL statements, or an entire program. Transactions have atomicity, consistency, isolation, and durability, which are often referred to as ACI D.
[0091] Traditional big data table formats (such as Hive tables) are not transactional and cannot guarantee data consistency in concurrent scenarios (such as read-write, write-write, etc.). The acquisition of Hive table data files depends on the List interface of the underlying file system, which has a large overhead and leads to metadata performance bottlenecks.
[0092] To this end, some data lake table formats have been proposed in the relevant technologies (such as Delta Lake, Apache Hud i, Apache Iceberg, etc.).
[0093] In the data lake table format in the related art, the table format can be transactional to ensure data consistency in concurrent scenarios, but it can only provide single-table transactions, which limits the business scenarios.
[0094] Also, in the data lake table format in the related art, the metadata of the data table (for example, in which data files the data of the data table is stored) is stored in the form of files in a file system or in a storage system such as an object storage system. Therefore, when accessing the metadata, more memory will be occupied and the access speed will be slow, resulting in higher access overhead and lower performance for metadata.
[0095] Furthermore, transactions rely on the atomicity of renaming the underlying storage of metadata, but the storage system in the related art cannot provide the atomicity of renaming the underlying storage that transactions rely on.
[0096] In addition, in the data lake table format in the related art, the statistical information of the data file is also recorded in the file system in the form of a file. Therefore, when using the statistical information to filter the data file, it is necessary to open the file on the underlying storage to read the statistical information to complete the filtering of the data file. Obviously, the overhead of filtering the data file is large, which reduces the filtering performance of the data file.
[0097] To this end, the present application provides a method for organizing metadata of a data table, which can store metadata in a database in the form of a metadata table. In the method, for each modification of the data table, the modification record (for example, the data file related to the modification of this data table) is identified in the metadata table with a version number, thereby recording the modification record of the data file in a multi-version manner in the database. Then, when accessing the metadata of the data table, the method can be implemented by accessing the metadata table stored in the database. Compared with accessing the file system, accessing the metadata table in the database is faster and occupies less memory, thereby improving the access speed to the metadata, reducing the access overhead of the metadata, and improving the access performance of the metadata.
[0098] In addition, in the method of the present application, the database has transaction capabilities, so that the metadata modification method provided by the present application has transaction capabilities to ensure data consistency in concurrent scenarios.
[0099] Figure 1a , Figure 1b The system architecture diagram of the present application is shown as an example.
[0100] like Figure 1a As shown, the data center cluster 100 may include but is not limited to: a computing cluster 101 and a storage cluster 102. The computing cluster 101 may include n computing nodes, namely computing nodes 1 to computing nodes n, and the number of computing nodes is not limited. The storage cluster 102 includes n storage nodes, namely storage nodes 1 to storage nodes n, and the number of storage nodes is not limited.
[0101] The following takes computing node 1 and storage node 1 as examples for description. Other computing nodes and storage nodes are similar and will not be described in detail here. Both computing nodes and storage nodes can be servers.
[0102] like Figure 1a As shown, computing node 1 may include application 201 , computing engine 202 , metadata management service 203 of data lake, and storage system 204 .
[0103] Among them, application 201 may be an application used by the user.
[0104] The computing engine 202 can be a big data computing engine such as Hive, Spark, etc., and there is no limitation here.
[0105] like Figure 1a As shown, the metadata management service 203 of the data lake provided in the present application can be directly deployed on the computing node 1, or it can be deployed on the virtual instance 200 shown by the dotted box in the computing node 1, wherein the virtual instance 200 can be a virtual machine or a container, which is not limited here.
[0106] The storage system 204 may be a distributed file system, such as GFS, HDFS, etc., or an object storage system, such as OBS, which is not limited here.
[0107] like Figure 1a As shown, the storage node 1 may include a database management system 205, and the database management system 205 may have transaction capabilities.
[0108] The database type of the database management system 205 may be a RDBMS or a NoSQL database, which is not limited here.
[0109] Combined with Figure 1a , please refer to Figure 1bThe data lake of the present application may include a computing engine 202 , a metadata management service 203 , a storage system 204 , and a database management system 205 .
[0110] The metadata management service 203 can manage the metadata of the data table for the application 201. Figure 1b It shows that the metadata management service 203 can manage the metadata of each data table in data table 1 to data table n.
[0111] The metadata management service 203 can provide users with three-level data table paths of catalog log (catalog object) / database (database object) / table (data table object), so that users can create a data table (table) in a database (DB for short) under a catalog log through the application 201 and the computing engine 202, and access a specific data table in a specific catalog log / DB.
[0112] Cata log / database is the parent object of the data table object (or is described as the path information of the data table object).
[0113] like Figure 1b As shown, the user creates n data tables under catalog 1 / database through application 201 and computing engine 202, which are data tables 1 to data tables n. The computing engine 202 can convert the user's insert operation, delete operation, and update operation on the data table into a write operation (e.g., adding a file, deleting a file) on the data file in the storage system 204. In this way, the data of each data table can be stored in at least one data file in the storage system 204, where data files 1 to data files k are exemplarily shown.
[0114] In order to manage and store metadata information of a data table (for example, which data files are related to the data in the data table, but not limited thereto), the metadata management service 203 of the present application can create multiple (here, n) metadata table table spaces of data table 1 in the database management system 205. Furthermore, the metadata management service 203 can store various metadata information of data table 1 in table space 1 of metadata table 1 to table space n of metadata table n, respectively.
[0115] The metadata management service 203 of the present application is used to manage the metadata of a data table so as to store the metadata of the data table in a table space of a metadata table related to the data table in the database management system 205 .
[0116] Please refer to Figure 1a and Figure 1b, the application 201 can send an access (read or write) request to the data table to the computing engine 202. The operation corresponding to the access request to the data table can be inserting records into the data table (corresponding to the insert operation), modifying records in the data table (corresponding to the update operation), deleting records in the data table (corresponding to the delete operation), and querying records in the data table.
[0117] However, the records in the data table are stored in the data file in the storage system 204. Therefore, when the computing engine 202 responds to the data table (eg, Figure 1b When the metadata management service 203 is requested to read a data table by a read request of data table 1 in the database in the catalog log 1, the metadata management service 203 of the present application can read the metadata of the data table 1 by accessing the table space of the metadata table related to the data table in the database management system 205 (for example, the table space 1 of the metadata table 1 of the data table 1), so as to return a list of data files related to the data table 1. In this way, the computing engine 202 can read the corresponding data files from the storage system 204 based on the list of data files returned by the metadata management service 203, and return the read data to the application, so as to enable the application to read the data table.
[0118] In addition, the computing engine 202 may perform a data file write operation to the storage system 204 in response to the write request of the application 201 for the data table, so as to complete the write operation on the data table. After the computing engine 202 completes a write operation on the data table each time, the computing engine 202 may send a write commit operation of the data table to the metadata management service 203 (for example, the computing engine 202 calls the writeCommit interface provided by the metadata management service 203), wherein the write commit operation may carry the modification record information of the data file related to the write operation on the data table this time (for example, the information of the newly added and / or deleted data file), and the metadata management service 203 may assign a version number to the transaction of the write operation on the data table, and write the version number in association with the modification record of the above data file to the table space of the metadata table related to the data table in the database management system 205 (for example, the table space of metadata table 1 of data table 1, which is not limited here), so that each modification of the data table can have a record in the database management system 205, and n metadata tables of data table 1 are shown here as an example, and the specific number is not limited.
[0119] In addition, when the metadata management service 203 assigns a version number to a transaction that performs a write operation on a data table, the version number may be uniformly incremented in the parent object (eg, database or catalog log) of the accessed data table, for example Figure 1bIn the catalog log 1, n data tables are created in total. When the metadata management service 203 assigns a version number to a transaction that performs a write operation on the data table 1, the version number can be incremented based on the latest version number of a transaction that has been successfully submitted to perform a write operation on any data table under the catalog log 1, and the incremented version number is assigned to the transaction that performs a write operation on the data table 1. The version numbers of transactions that perform write operations on data tables in different catalog logs are independent of each other and do not affect each other. The version number can be generated by the sequence of the RDBMS, or by the global increment transaction number of the DB, or by other algorithms. There is no restriction on the increment strategy of the version number.
[0120] Figure 1a , Figure 1b The following is a schematic diagram showing the system framework structure. It should be understood that: Figure 1a , Figure 1b The system shown is only an example, and the system of the present application may have more or fewer components than shown in the figure, may combine two or more components, or may have a different component configuration. Figure 1a , Figure 1b The various components shown in the EMBODIMENTS 2000 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.
[0121] The metadata management service 203 of the present application provides a write service and a read service for the metadata table of the data table, and both the write service and the read service are transactional. Among them, the service of the present application can provide single-table transactions and multi-table transactions.
[0122] A single-table transaction is used to indicate that only one data table is operated in the transaction. Therefore, the metadata management service 203 of the present application can operate the metadata table of a single data table in the single-table transaction.
[0123] A multi-table transaction is used to indicate that multiple data tables are operated within a transaction. The metadata management service 203 of the present application can operate metadata tables of multiple data tables within a multi-table transaction.
[0124] Whether it is a single-table transaction or a multi-table transaction, it can include write operations and / or read operations on the data table, so each operation on the data table can be a single-statement transaction.
[0125] Writing process of metadata table: In the metadata management service 203 of the present application, in a single-statement transaction for writing operations on a data table (the execution of each SQL statement corresponds to a transaction), each time a write operation (such as an insert operation, an update operation, a delete operation) is performed on the data table, the computing engine 202 needs to call the writeCommit interface provided by the metadata management service 203 of the present application once to write the metadata information of the current modification to the data table into the table space of the corresponding metadata table in the database management system 205.
[0126] Reading process of metadata table: In the metadata management service 203 of the present application, in the transaction of reading the data table, the computing engine 202 can call the listFile interface provided by the metadata management service 203 of the present application, and the metadata management service 203 can access the metadata table space in the database management system 205 to return the modification record information (a kind of metadata information) about the data file of the data table to the computing engine 202, so that the computing engine 202 can read the data of the corresponding data file based on the modification record information of the data file to realize the reading operation of the data table.
[0127] The following describes the present application with different examples. Figure 1a , Figure 1b The system shown is the writing and reading process of the metadata table.
[0128] Example 1: Metadata table writing process
[0129] Combined with Figure 1a , Figure 1b , Figure 2a The figure is a schematic diagram showing the data processing process of the system of the present application for example.
[0130] Take a single-table single-statement transaction as an example, combined with Figure 2b to Figure 2e To illustrate Figure 2a process, such as Figure 2a As shown, the process may include the following steps:
[0131] S101 , after the computing engine 202 performs a write operation on the first data table, a write commit operation is sent to the metadata management service 203 .
[0132] The write operation may be any one of an insert operation (inserting a record), an update operation (updating a record), and a delete operation (deleting a record).
[0133] For example, the first data table is Figure 2b The data table mentioned 1 (such as student performance table).
[0134] When a transaction for writing to the first data table starts, metadata management service 203 may determine a source version number for the transaction.
[0135] The computing engine 202 may write to the first data table using a copy-on-write snapshot technology or a copy-on-write snapshot technology (Copy-On-Write, COW) or a merge on read (MOR) method. Figure 2b and Figure 2c Let's explain the two data writing methods mentioned above and the process of modifying data files.
[0136] Figure 2b The processing procedure of the COW method (a full data update method) is exemplified.
[0137] like Figure 2b As shown in (1), when the computing engine 202 performs an insert operation on the data table 1, for example, inserting one or more records into the data table 1, the computing engine 202 may add a data file F2 (or multiple data files may be added, which is not limited here) about the data table 1 in the storage system 204. The data file F2 includes the one or more records inserted into the data table 1 by this insert operation. Then, after this insert operation, a data file F2 may be added in the storage system 204.
[0138] like Figure 2b As shown in (2), when the computing engine 202 performs an update operation on the data table 1, for example, to modify one or more records in the data table 1, and the records to be modified are located in the data file F1, the computing engine 202 can add a new data file F1' in the storage system 204, and delete the data file F1 (here the data file F1 can be marked as delete, not necessarily directly deleted).
[0139] The calculation engine 202 may merge the records in the data file F1 that are not modified this time and one or more records that are modified this time into the data file F1 ′.
[0140] The data file F1' belongs to "data addition operation record", and the data file F1 belongs to "data deletion operation record".
[0141] Figure 2b (3) Figure 2b (4) shows two scenarios of performing a delete operation on data table 1.
[0142] exist Figure 2bIn (3), the data file F1 of the data table 1 in the storage system 204 stores multiple records. When the computing engine 202 performs a delete operation on the data table 1, it does not delete all the records in the data file F1. Therefore, this method of adding a data file is similar to Figure 2b (2) Situation. After computing engine 202 performs a delete operation on data table 1 (deleting records in this case), computing engine 202 may add a new data file F1'' to storage system 204, and delete the data file F1 (here, data file F1 may be marked as deleted, not necessarily directly deleted). Computing engine 202 may write the records in data file F1 that have not been deleted to data file F1''.
[0143] exist Figure 2b In (4), there are multiple records stored in the data file F1 of the data table 1 in the storage system 204. When the computing engine 202 performs a delete operation on the data table 1, all the records in the data file F1 can be deleted. Therefore, after the computing engine 202 performs a delete operation on the data table 1 (here, all records are deleted), no new data file related to the data table 1 will be added to the storage system 204, but the data file F1 will be deleted (here, the data file F1 can be marked as delete, not necessarily directly deleted), wherein the data file F1 belongs to the "deletion data operation record".
[0144] Figure 2c The processing procedure of the MOR method (an incremental data update method) is exemplified.
[0145] like Figure 2c As shown in (1), when the computing engine 202 performs an insert operation on the data table 1, for example, inserting one or more records in the data table 1, for example, adding records based on the data file F1, the computing engine 202 can add a data file (named Add-F1) about the data table 1 in the storage system 204 (it can also be adding multiple data files, which is not limited here), wherein the data file Add-F1 is written with one or more records inserted by this insert operation. Here, the newly added data file Add-F1 is associated with the data file F1 by the name of the data file to indicate which data file the data in the data file Add-F1 is based on for the addition of data records. Then, after this insert operation, the data file Add-F1 can be added to the storage system 204, and the data file F1 continues to be retained.
[0146] like Figure 2cAs shown in (2), when the computing engine 202 performs an update operation on the data table 1, for example, one or more records are modified in the data table 1, for example, the record is modified based on the data file F1, then the computing engine 202 can add a data file (named Add-F1) about the data table 1 (or multiple data files can be added, which is not limited here) and a data file (named Delete-F1) about the data table 1 (or multiple data files can be added, which is not limited here) in the storage system 204. Among them, the data file Add-F1 contains one or more records modified by this insert operation. The data file Delete-F1 contains one or more records before the modification of this insert operation. Among them, the data file Add-F1, the data file Delete-F1 and the data file F1 are associated here by the name of the data file to indicate which data file the data in the data file Add-F1 and the data file Delete-F1 are based on which data record modification is performed. Then after this update operation, the data file Add-F1 can be added to the storage system 204, the data file Delete-F1 can be added and the data file F1 can continue to be retained. And the data in the data file Delete-F1 is the data deleted by this update operation, so the data file Delete-F1 belongs to the "deletion data operation record". The data in the data file Add-F1 is the data added by this update operation, so the data file Add-F1 belongs to the "new data operation record". The metadata management service 203 can determine whether the file belongs to the "new data operation record" or the "deletion data operation record" based on the prefix of the file name.
[0147] exist Figure 2cIn (3), when the computing engine 202 performs a delete operation on the data table 1, for example, deleting one or more records in the data table 1, for example, deleting records based on the data file F1, the computing engine 202 can add a data file (named Delete-F1) about the data table 1 in the storage system 204 (it can also be adding multiple data files, which is not limited here), and the computing engine 202 writes one or more records that need to be deleted this time to the data file Delete-F1. The metadata management service 203 can associate the data file Delete-F1 with the data file F1 by the name of the data file to indicate which data file the data in the data file Delete-F1 is based on to delete the data record. Then, after this delete operation, the data file Delete-F1 can be added to the storage system 204 and the data file F1 continues to be retained, and the data in the data file Delete-F1 is the data that needs to be deleted in this delete operation, so the data file Delete-F1 belongs to the "deletion data operation record".
[0148] In passing Figure 2b , Figure 2c After introducing the two writing methods of the computing engine 202 to the data table, it can be understood that after the computing engine 202 performs a write operation on the data table 1, a "new data operation record" and / or a "deleted data operation record" can be generated in the storage system 204.
[0149] Among them, "newly added data operation record" is used to indicate a data file that includes newly added records. Figure 2b The data files F2, F1', and F1' in the data file are as follows: Figure 2c The data file in Add-F1.
[0150] "Delete data operation record" is used to indicate a data file that includes a record of deletion. Figure 2c In the data file F1. Figure 2c Data file De lete-F1 in.
[0151] For example, in Figure 2b In the COW method shown in the figure, Figure 2b In (1), the "new data operation record" generated by an insert operation is the data file F2.
[0152] exist Figure 2b In (2), the "new data operation record" generated by an update operation is the data file F1', and the "delete data operation record" is the data file F1.
[0153] exist Figure 2b In (3), the "new data operation record" generated by a delete operation is data file F1", and the "delete data operation record" is data file F1.
[0154] exist Figure 2b In (4), the "delete data operation record" generated by a delete operation is the data file F1.
[0155] For example, in Figure 2c In the MOR method shown in Figure 2c In (1), the "new data operation record" generated by an insert operation is the data file Add-F1.
[0156] exist Figure 2c In (2), the "additional data operation record" generated by an update operation is the data file Add-F1, and the "deletion data operation record" generated is the data file Delete-F1.
[0157] exist Figure 2c In (3), the "delete data operation record" generated by a delete operation is the data file Delete-F1.
[0158] Continue to refer to Figure 2b In S101, the computing engine 202 may call the writeCommit interface provided by the metadata management service 203 to send a write commit operation to the metadata management service 203, and the computing engine 202 will call the writeCommit interface once each time it executes a write operation on the data table.
[0159] Among them, when calling the writeCommit interface, the computing engine 202 can pass in at least one of the following parameter information: the parent object information of the first data table (or the path information described as the first data table), the source version number, the first modification record information of the data file for this write operation, and the statistical information of the data file related to this write operation.
[0160] For example, in Figure 2c In (2), the above statistical information may include the data file Add-F1, the data file Delete-F1, and the statistical information of each data file in the data file F1. The other information is similar and will not be described here.
[0161] For example, in Figure 2b In (2), the above statistical information may include the statistical information of the data file F1' and each data file in the data file F1. The rest is similar and will not be described here.
[0162] The parent object information of the first data table is used to indicate which database under which catalog log the first data table belongs to. Figure 1b The parent object information of data table 1 is as follows Figure 1b Cata log1 / database shown.
[0163] As described above, the version number is allocated based on the parent object of the data table (here, the catalog log), and the version number is strategically incremented within the same parent object (here, the catalog log). That is, all transactions of data tables in the same catalog log correspond to a version number allocator, and the version number is guaranteed to be incremented. In other embodiments, the version number may also be allocated based on the database in the catalog log, and the version number is strategically incremented within the same database under the same catalog log, which is not limited here.
[0164] Among them, the source version number is used to indicate the latest version number in the metadata table of data table 1 or the latest version number of the data related to data table 1 in the metadata table of the parent object of data table 1 when the computing engine 202 performs a write operation (such as an insert operation) on the first data table (hereinafter referred to as data table 1) this time.
[0165] For example, when computing engine 202 performs a write operation on data table 1, it can first read the maximum version number of data table 1 from the metadata table of data table 1 or the metadata table of the parent object of data table 1 through metadata management service 203 as the source version number passed in when calling the above interface.
[0166] The source version number can be used to identify the version number corresponding to the latest modification record of data table 1 when the write operation is performed on data table 1. In other words, the source version number is used to indicate which modification version of data table 1 the write operation is based on.
[0167] For example, when a transaction (e.g., transaction 1) that performs a write operation on data table 1 begins, the metadata management service 203 may read the maximum version number of data table 1 from the metadata table of data table 1 or the metadata table of the parent object of data table 1 as the source version number of transaction 1. After transaction 1 performs a write operation on data table 1 (e.g., inserting a record to change the data file related to data table 1), the computing engine 202 may call the writeCommit interface to commit transaction 1, and the metadata management service 203 may assign the first version number to the transaction when transaction 1 is committed.
[0168] continue Figure 2aIn S101, the first modification record information of the data file is the data file list information generated in the storage system 204 after the computing engine 202 performs the write operation on the data table 1. The data file list may include a list of "newly added data operation records" and / or a list of "deleted data operation records".
[0169] The definitions of "additional data operation records" and "deletion data operation records" refer to Figure 2b , Figure 2c The explanations and examples are not repeated here.
[0170] Take the write operation in S101 as Figure 2a Taking the insert operation in (1) as an example, the first modification record information may include a list of newly added data files (here, data file F2), and information indicating that data file F2 is a "newly added data operation record", for example, with an add mark.
[0171] Take the write operation in S101 as Figure 2a Taking the update operation in (2) as an example, the first modification record information may include a list of newly added data files (here, data file F1'), and information indicating that data file F1' is a "new data operation record", a list of "deleted data operation records" (here, data file F1), and information indicating that data file F1 is a "deleted data operation record".
[0172] Take the write operation in S101 as Figure 2a Taking the delete operation in (3) as an example, the first modification record information may include a list of "newly added data operation records" (here is data file F1"), and information indicating that data file F1 is a "newly added data operation record", a list of "deleted data operation records" (here is data file F1), and information indicating that data file F1 is a "deleted data operation record", for example, with a delete mark.
[0173] Take the write operation in S101 as Figure 2a Taking the delete operation in (4) as an example, the first modification record information may include a list of "delete data operation records" (here, data file F1), and information indicating that data file F1 is a "delete data operation record".
[0174] S102: The metadata management service 203 assigns a first version number to the current transaction corresponding to the write commit operation.
[0175] As mentioned above, the version number is allocated based on the parent object of data table 1 (catalog 1 in this case). The version number is strategically incremented within the same catalog 1. That is, all transactions of all data tables in the same catalog 1 correspond to a version number allocator, and the version number is guaranteed to be incremented.
[0176] The current transaction here may be a single statement transaction that performs a write operation on data table 1. Figure 2d For example, the current transaction is transaction 1, which is a single statement transaction that performs an insert operation on data table 1 in catalog log 1. When transaction 1 performs an insert operation on data table 1, no write operation is performed on all data tables in catalog log 1 to which data table 1 belongs. The metadata management service 203 can determine that the source version number assigned to transaction 1 is empty by reading the version number in the metadata table of catalog log 1. Transaction 1 calls the writeCommit interface of the metadata management service 203 at time t1 to commit transaction 1. Then the metadata management service 203 can read the latest version number (which is empty here) in the metadata table of catalog log 1, increment the version number based on the latest version number, obtain the first version number, and assign the first version number V1 to transaction 1.
[0177] Optionally, before S107b, the metadata management service 203 may perform conflict judgment on the current transaction to determine whether there is a transaction that conflicts with the current transaction.
[0178] Since transactions can be executed concurrently, in order to ensure the accurate writing and data consistency of the current transaction data, transaction conflict judgment needs to be performed before the relevant information of the current transaction is written into the metadata table related to data table 1. When performing conflict judgment on the current transaction, the specific process may include S103 to S106.
[0179] S103: The metadata management service 203 obtains a mutex lock of a first metadata table of a first type of a first data table.
[0180] Here, the metadata table of the first data table (e.g., data table 1) is divided into two types, namely, the first type and the second type, wherein the metadata table of the first type is used to store the version number and the modification record information of the data file. The metadata table of the second type is used to store the statistical information, partition information, etc. of the data file, and is used for filtering and screening of the data file to realize the fast query of the modification record information in the metadata table of the first type.
[0181] When determining a transaction conflict, it is necessary to compare the modification record of the data file of the current transaction with the first metadata table of the first type (eg Figure 1b Table 1 shown, Table 1 can be specifically used for modifying the data in Table 2) below. In order to ensure the accuracy of transaction conflict judgment, during the transaction conflict judgment, the metadata management service 203 can add a mutex lock to the Table 1 in the database management system to achieve mutual exclusion of modification of Table 1. After successfully acquiring the mutex lock of the corresponding object, the transaction conflict check from S104 to S106 is performed to ensure the correctness of concurrent operations in the check process. After the transaction conflict judgment is completed, the mutex lock is released.
[0182] For example, the following Table 1 is the metadata table of catalog log1, and Table 2 is the metadata table of data table 1 in catalog log1 / database (named Table le1).
[0183] Then the first metadata table of the first type of the first data table (eg, data table 1) may be the following table 2. In S103, the metadata management service 203 may acquire a lock (eg, a mutex lock) of table 2.
[0184] In other embodiments, since the parent object of data table 1 (e.g., catalog 1) also has a first type of metadata table (e.g., Table 1 below), the first type of first metadata table of the first data table (e.g., data table 1) in S103 may also be Table 1 below, and the metadata management service 203 may add a mutual exclusion lock to Table 1, as well as add a mutual exclusion lock to the records in Table 1 whose "associated metadata table name" is Table 1 (e.g., the first and second records in Table 1 below).
[0185] Table 1 is a metadata table of catalog 1 stored in the database management system 205:
[0186]
[0187] Table 1
[0188] Table 2 is a metadata table (named Table 1) of data table 1 in catalog 1 / database, which belongs to catalog 1 object and is stored in the database management system:
[0189]
[0190] Table 2
[0191] The relationship between the above Table 1 and the above Table 2 is: Table 1 may include the data in the metadata table of each data table under catalog log1 (for example, the version number and FileGroup associated with the storage).
[0192] S104 , the metadata management service 203 queries the database management system 205 for the first metadata table of the first type based on the source version number and the first version number.
[0193] S105, the metadata management service 203 obtains the query result from the database management system 205, which is the second modification record information of the data file between the source version number and the first version number.
[0194] S106: The metadata management service 203 determines whether there is a transaction that conflicts with the current transaction based on the first modification record information and the second modification record information.
[0195] Below is a combination of Table 1, Table 2, Figure 2b , Figure 2d To illustrate S104 to S106, the calculation engine 202 writes data in a COW manner as an example. When the data writing method is MOR, the method of the above process is the same and will not be repeated here.
[0196] When the write operation of the current transaction is an insert operation, such as Figure 2b As shown in (1), the insert operation does not involve the deletion of data records. Therefore, when the write operation of the current transaction is an insert operation, there is no transaction that conflicts with the current transaction, and no transaction conflict judgment is made, that is, no execution is performed. Figure 2a In S103 to S106, after S102, S107b is directly executed, and optionally, S108 can be executed after S102.
[0197] When the write operation of the current transaction is an update operation or a delete operation, such as Figure 2b (2) Figure 2b (3) Figure 2b As shown in (4), when the computing engine 202 performs the above-mentioned write operation, a "delete data operation record" will be generated in the storage system 204, and a transaction conflict judgment needs to be performed, wherein the definition of "delete data operation record" is as mentioned above and will not be repeated here. When performing transaction conflict judgment, if the modification record information of the data file whose version number is between the source version number and the first version number in the first metadata table with the mutex lock in S103 exists in the modification record information of the data file whose version number is between the source version number and the first version number, and there is a "delete data operation record" (for example, Figure 2b (2) If there is no deletion record of the data file F1) in step (2), it can be determined that there is a transaction that conflicts with the current transaction; if there is no deletion record of the "deletion data operation record" generated by the above write operation in the modification record information of the data file whose version number is between the source version number and the first version number in the first metadata table with the mutex lock in step S103, it can be determined that there is no transaction that conflicts with the current transaction.
[0198] Here we introduce Figure 2d Before the process, the data structure of the first type of metadata table of the present application is first explained. As shown in Tables 1 and 2 above, the metadata table for storing modification record information of data files related to each modification of the data table may include version numbers and modification record information of the data files (also called "FileGroup").
[0199] Among them, FileGroup includes an operation (Add or Delete) and storage path information of the file, and the operation is used to indicate whether to add (Add) or delete (Delete) the data in the file of the file path information.
[0200] The data in the FileGroup column can be of JSON type or serialized binary, and there is no restriction here.
[0201] Continue to refer to Figure 2b and Figure 2c ,exist Figure 2b In (1), after the insert operation, data file F2 is generated. After the write commit operation (no transaction conflict judgment is made here), the FileGroup written to the metadata table corresponding to data table 1 is: Add: F2, for example Figure 1a , Figure 1b If the storage system 204 is an object storage system (such as OBS), Add:F2 can also be replaced by Add:hpps: / / bucket name.domain name / object name, where the object name is F2 here.
[0202] exist Figure 2b In (2), after the update operation, the data file F1' is generated. After the write commit operation (for example, it is determined that there is no transaction that conflicts with the current transaction), the metadata management service 203 writes the FileGroup: Add: F1' and Delete: F1 to the metadata table corresponding to the data table 1 (for example, the above Table 1 and the above Table 2).
[0203] Similarly, in Figure 2b In (3), the FileGroup written by the metadata management service 203 to the metadata table corresponding to the data table 1 is: Add: F1" and Delete: F1.
[0204] Similarly, in Figure 2b In (3), the FileGroup written by the metadata management service 203 to the metadata table corresponding to the data table 1 is: Delete: F1.
[0205] Similarly, in Figure 2c (1) to Figure 2cIn (3), after the metadata management service 203 receives the write commit operation, when executing S107b, the FileGroups written to the metadata table corresponding to the data table 1 (for example, the above-mentioned Table 1 and the above-mentioned Table 2) are respectively Figure 2c (1) Add: Add-F1, Figure 2c (2) Add: Add-F1, Delete: Delete-F1, Figure 2c De lete: De lete-F1 shown in (2).
[0206] Combine the following Figure 2d To understand Figure 2a The process of writing records in Tables 1 and 2 is described as follows:
[0207] like Figure 2d As shown, for example, the current transaction is transaction 1, which is a single statement transaction that performs an insert operation on data table 1 in catalog log 1. When transaction 1 performs an insert operation on data table 1, all data tables in catalog 1 to which data table 1 belongs do not perform any write operation. The metadata management service 203 can determine that the source version number is empty by reading the version number in the metadata table of catalog log 1. Transaction 1 calls the writeCommit interface of the metadata management service 203 at time t1 to commit the transaction. The metadata management service 203 can read the latest version number (empty here) in the metadata table of catalog log 1 (for example, at this time, table 1 does not have any record data), increment the version number based on the latest version number, obtain the first version number, and assign the first version number V1 to transaction 1. The write operation here is an insert operation, that is, the parameters in the writeCommit interface include a list of "newly added data operation records" but do not include a list of "deleted data operation records", then the metadata management service 203 can write the version number V1 associated with FileGroup1 (here Add: F1) into Table 2 to write the first record in Table 2. In addition, the metadata management service 203 can also write V1 associated with FileGroup1 (here Add: F1) and the name of Table 2 (here Table 1) into Table 1 to write the first record in Table 1.
[0208] like Figure 2d As shown, after transaction 1, the next single-statement transaction includes Figure 2dAs shown in the figure, transactions 2 and 3 are executed in parallel. When transaction 2 is executed, the current transaction is transaction 2, which updates table 1. When transaction 2 starts, the latest version of Table 1 in Table 1 is V1, so V1 is used as the source version number. Alternatively, if Table 2 is queried and the latest version in Table 2 (i.e. Table 1) is V1, V1 is used as the source version number.
[0209] Transaction 2 calls the writeCommit interface of metadata management service 203 at time t2 to commit the transaction and send a write commit operation to metadata management service 203. Then metadata management service 203 can assign a first version number to transaction 2 when transaction 2 is committed. Metadata management service 203 can increment the latest version number V1 assigned by the transaction operating the data table in catalog log1 to obtain the first version number V2. Then, the metadata management service 203 can query Table 2 for data modification records with version numbers between V1 and V2. If such data modification records do not exist here, it is determined that there is no transaction that conflicts with the current transaction. Then, the metadata management service 203 can write the first version number V2 in association with FileGroup2 (here Add: F1' and Delete: F1) into Table 2 to write the second record in Table 2, and the metadata management service 203 can also write V2 in association with FileGroup2 (here Add: F1' and Delete: F1) and the name of Table 2 (here Table 1) into Table 1 to write the second record in Table 1.
[0210] like Figure 2d As shown, when transaction 3 is executed, the current transaction is transaction 3, and transaction 3 performs an update operation on data table 1. When transaction 3 performs the update operation, the latest version number of the above table 1 is also V1. Here, transaction 3 and transaction 2 are both executed after transaction 1, and transaction 2 and transaction 3 are executed in parallel. Therefore, V1 is also used as the source version number of transaction 3 passed into the writeCommit interface.
[0211] Transaction 3 calls the writeCommit interface of metadata management service 203 at time t3 to send a write commit operation to metadata management service 203. Then, metadata management service 203 can assign a first version number to transaction 3. Metadata management service 203 can increment the latest version number V2 assigned by the transaction operating the data table in catalog 1 to obtain the first version number V3, so as to assign the third version number V3 to transaction 3. Then, metadata management service 203 can query Table 2 for the second data modification record information with a version number between V1 and V3. Here, metadata management service 203 queries Table 2 for the second record with a version number between V1 and V3: the version number is V2, and FileGroup is [Add: F1' and Delete: F1]. Figure 2d As shown, when transaction 3 performs an update operation on data table 1, the first data modification record information passed to the writeCommit interface includes the newly added data file F1", and the deleted data file F1 (also corresponding to Delete: F1). Therefore, the data file F1 with a deletion mark corresponding to the write commit operation submitted by transaction 3 to data table 1 is the same as the data file F1 with a deletion mark in the second record mentioned above. Therefore, the metadata management service 203 determines that there is a transaction (here, transaction 2) that conflicts with transaction 3 within the time period of transaction 3 from V1 to V3.
[0212] Therefore, transaction 3 fails to execute. After receiving the information indicating that the current transaction (here, transaction 3) has failed, computing engine 202 can delete the data files generated by the update operation in transaction 3 involved in storage system 204. Then, transaction 3 is re-executed. When the update operation of data table 1 is performed when transaction 3 is re-executed, the latest version number in table 2 is already V2 in the second record. Therefore, metadata management service 203 can send V2 as the source version number to computing engine 202, so that computing engine 202 can pass in the source version number when calling the writeCommit interface.
[0213] Of course, in the above process, when querying the modification record information of data files with version numbers between the source version number and the first version number from the metadata table of data Table 1, you can not only query from Table 2, but also filter and query the modification record information of data files with version numbers between the source version number and the first version number in the records whose "associated metadata table name" is Table 1 in Table 1. Then, compared with querying from Table 1, querying the modification record information of data files with version numbers between the source version number and the first version number from Table 2 is more efficient.
[0214] The above process describes the writing process of the first two records in Table 1 and the writing process of the records in Table 2. The writing process of the third and fourth records in Table 1 is similar to the writing process of the first two records in Table 1. The third and fourth records in Table 1 are two new records added to Table 1 through S107b after the computing engine writes to Data Table 2 and calls the writeCommit interface of the metadata management service 203. The specific process will not be repeated here, and refer to the description of the writing process of Data Table 1.
[0215] like Figure 2d As shown, although transaction 2 and transaction 3 perform update operations on data table 1 based on the update operation of the most recently modified data table 1 corresponding to the source version number V1, transaction 2 has called the writeCommit interface before transaction 3 calls the writeCommit interface and writes the modification records of the data files related to the update operation in transaction 2 to the metadata table of data table 1 (such as Table 1 shown in Table 2). Therefore, in order to ensure data consistency, transaction 3 fails to commit.
[0216] For ease of understanding, let's take an example. For example, both transaction 2 and transaction 3 update the grades in the student's grade table. When the grades are updated in both transactions, the value of the grade before the update is 80 (corresponding to Figure 2d V1 in the example, transaction 2 increases the value of the grade in storage system 204 by 5 after time t1, that is, updates it to 85, and writes the data modification record information related to the modification of the student grade table to the metadata table of the student grade table (e.g., Table 2) at time t2, so that the updated grade (85) has taken effect. Transaction 3 increases the value of the grade in storage system 204 by 10 after time t1, that is, updates it to 90, and writes the data modification record information related to the modification of the student grade table to the metadata table of the student grade table (e.g., Table 2) at time t3 by calling the writeCommit interface request. However, at time t3, the grade has been updated to 85. If it is increased by 10 again, it needs to be updated to 95 instead of 90. Therefore, in order to ensure data consistency and avoid data writing errors, transaction 3 fails to execute due to a transaction conflict with transaction 2.
[0217] In the above Figure 2dIn the example, transaction 3 writes table 1 at V1 and calls writeCommit interface at version V3. Although after calling writeCommit interface and before determining transaction conflict, transaction 3 adds a mutex lock to table 2 at time V3, before adding the mutex lock to table 2, data file F1 corresponding to table 1 has been modified by transaction 2 (modification of the same data file F1 as transaction 3), and transaction 2 has completed the write commit operation before V3, making version number V2 effective, thus causing transaction 2 to conflict with the currently executed transaction 3.
[0218] When making transaction conflict judgments, this application can make transaction conflict judgments at the file-level granularity. If two transactions involve deleting or updating the same data file, it can be determined that there is a transaction that conflicts with the current transaction, and the current transaction submission will fail.
[0219] Optionally, when the metadata management service 203 determines that there is a transaction that conflicts with the current transaction, S107a is executed, and the metadata management service 203 sends information indicating that the current transaction fails to be submitted to the computing engine 202 .
[0220] In a possible implementation, when the metadata management service 203 determines that there is no transaction that conflicts with the current transaction, S107b is executed, and the metadata management service 203 can write the first version number and the first modification record information of the data file into the first metadata table of the first type in association.
[0221] In an embodiment of the present application, the operation of a single statement on a data table can be transactional, wherein each time a write operation is performed on the data table, the computing engine 202 needs to call the writeCommit interface provided by the metadata management service 203, and through transaction conflict detection, to ensure that the process of calling the writeCommit interface of the present application can be transactional.
[0222] In some embodiments, in the above process, after the single-statement transaction performs a write operation on data table 1, it calls the metadata management service 203 to perform a write commit operation, then a record can be written to table 2 in the database management system 205. After the single-statement transaction is committed, the metadata management service 203 can add the data in table 2 to the metadata table corresponding to catalog 1 to which data table 1 belongs, such as the above-mentioned Table 1, so that the first record and the second record are written into table 1. The writing principle of the two records related to Table le2 in Table 1 is similar to the introduction of Table le1 (i.e., the metadata table of data table 1), and will not be repeated here.
[0223] In a possible implementation, the metadata management service 203 of the present application may merge small data files of the same type in a FileGroup associated with the same version number, where the data files of the same type refer to the same "new data operation record" or the same "delete data operation record". When merging small data files, the metadata management service 203 may periodically perform the above-mentioned small data file merging operation, or, when the metadata management service 203 determines that the number of small data files in the same FileGroup is greater than a preset threshold, perform the small data file merging operation.
[0224] The small data file may be a data file whose file size is smaller than a specific threshold.
[0225] For example, each time the computing engine 202 performs an insert operation or an update operation, the data file written is very small (eg, less than 20k).
[0226] For another example, there are overlaps in statistical values (e.g., values of the grade column parameters of the student grade table) between data files. For example, the calculation engine 202 inserts the scores of students into the student grade table (an example of data table 1), and each student has a corresponding data file, and the scores of more than half of the students' data files are in the range of 80 to 100.
[0227] Then when data files are read, it is necessary to screen the data files, and a large number of small data files are not conducive to the filtering of data files, thereby affecting the metadata information (such as the data file list that meets the screening condition) reading performance of the data table. For this reason, the metadata management service 203 of the present application may include a background optimization task, which can start the small file merging task according to the strategy (the number of small data files in the same FileGroup reaches a threshold value or regularly). The small file merging task can merge the small data files into a pre-configured agreed file size. Similarly, when the metadata management service 203 carries out the transaction of the merger of data files, a new version number can be assigned to the transaction at the beginning of the transaction, and the distribution strategy of the version number is also to increase progressively on the basis of the version number that has been distributed in the same catalog.
[0228] In one possible implementation, the FileGroup generated by the transaction that merges data files by the metadata management service 203 can be distinguished from other FileGroups in the metadata table (for example, the FileGroup written by calling the writeCommit interface) by using a version number identifier, a FileGroup identifier, or by adding a new field in the metadata table of the data table (for example, Table 1 or Table 2).
[0229] In a possible implementation, the FileGroup generated by the transaction for merging data files by the metadata management service 203 may include not only the modification record information of the data files written by the transaction for merging data files, but also the modification record information of the data files associated with all version numbers before the version number of the FileGroup in the corresponding metadata table. For example, the FileGroup includes not only the modification records of the merged data files, but also the modification records of the referenced data files related to each unmerged version number. This organization of the FileGroup can take into account the query efficiency of file reading and can also have better streaming data reading and writing performance.
[0230] Below Figure 2e Table 3 is used as an example to illustrate the process of merging data files and writing modification records of related data files into the metadata table in the database management system 205.
[0231] like Figure 2e As shown, the metadata management service 203 receives a write commit operation for the insert operation of the data table 1 at time t1, and assigns a first version number V1 to the current transaction corresponding to the write commit operation, and writes the modification record information of the data file related to the write commit operation, associated with the first version number V1, to the metadata table (here is Table 3) of catalog 1 to which the data table 1 belongs in the database management system 205, thereby obtaining the first record in Table 3, the version number of the first record is V1, and FileGroup is Figure 2e Optionally, the metadata management service 203 may write the modification record information of the data file related to the write-commit operation, and write the metadata table associated with the first version number V1 to the data table 1 in the database management system 205,
[0232] Similarly, the metadata management service 203 receives the write commit operation of the insert operation on the data table 1 at time t2, and assigns the first version number V2 to the current transaction corresponding to the write commit operation, and writes the modification record information of the data file related to the write commit operation, associated with the first version number V2, to the metadata table (here is Table 3) of catalog 1 to which the data table 1 in the database management system 205 belongs, thereby obtaining the second record in Table 3. The version number of the second record is V2, and the FileGroup is Figure 2e FileGroup2 shown.
[0233] In addition, the metadata management service 203 can periodically initiate a small file merging task, for example, Figure 2e The time t3 shown indicates that the computing engine 202 merges the small data files in the same FileGroup in the storage system 204. Specifically, the data files F1 and F2 may be deleted (or deleted marks may be set to facilitate rollback in case of transaction failure) and a new data file F4 may be added in the storage system 204. The data file F4 includes file data obtained by copying all data of the data file F1 and file data obtained by copying all data in the data file F2.
[0234] Then, the metadata management service 203 may receive the modification record information of the data file generated by the file merging operation from the computing engine 202, wherein the list of "deleted data operation records" includes F1 and F2, and the list of "added data operation records" includes F4. The metadata management service 203 may increment the version number in the catalog log1 to which the data table corresponding to the data file merged this time belongs, from V2 to V3, and assign V3 to the transaction that performs the small file merging task.
[0235] And the metadata management service 203 can be used with V3 Figure 2e The FileGroup3 associated with V3 is written into Table 3 to write the third record into Table 3, wherein the version number of the third record is V3, and FileGroup3 includes the modification record information of the data files involved in this file merge, specifically Add: F4, Delete: F1, F2. In addition, FileGroup3 associated with V3 also includes the version number (here V2) of FileGroup2 in Table 3 whose version number is less than V3 and which has not been merged this time. Here, in the third record of Table 3, FileGroup (V2) is used to indicate that FileGroup2 with version number V2 in Table 3 is referenced to FileGroup3 associated with V3.
[0236] In this way, when the metadata management service 203 uses the modification record information of the data files in the metadata table stored in the database management system 205 to obtain the list of data files that the application 201 or the computing engine 202 or the metadata management service 203 itself needs to access, the metadata management service 203 does not need to read the small data files multiple times, thereby improving the reading performance of the metadata of the data table; moreover, when reading a FileGroup such as shown in Table 3, if the FileGroup read is represented by a FileGroup generated by merging data files (such as the FileGroup of the third record), there is no need to read the FileGroup whose version number is before the version number of the FileGroup. For example, there is no need to read the first record and the second record in Table 3, and only the third record needs to be read. This can achieve the reading of the first to third records, and can take into account the query efficiency of file reading.
[0237] Exemplarily, the metadata management service 203 of the present application may merge multiple modification record information of data files of the same data table.
[0238] In a possible implementation, after the small data files are merged, the metadata management service 203 may obtain the data statistics information of the merged data file (e.g., data file F4 in Table 3) to store in the metadata table of the second type. The metadata table of the second type is also a metadata table stored in the database management system 205, and this type of metadata table is used to store the data statistics information of the data files related to the data table (e.g., the above-mentioned data table 1, etc.). For example, the merged data files are multiple data files of the student score table exemplified above, and each data file stores the score of a student. Then, the data statistics information of the merged data file F4 shown in Table 3 may include the statistical information of the student's score, for example, the score range is 80 to 100.
[0239] Table 3 is an exemplary metadata table of catalog 1 stored in a database management system:
[0240]
[0241] Table 3
[0242] In a possible implementation, after S102 , or when the metadata management service 203 determines that there is no transaction that conflicts with the current transaction, the metadata management service 203 may execute S108 .
[0243] S108 , the metadata management service 203 writes or updates the metadata of the second type of the first data table in the database management system 205 based on the data statistical information of the data file.
[0244] The second type of metadata table is also a metadata table stored in the database management system 205. This type of metadata table is used to store data statistical information of data files related to a data table (such as the above-mentioned data table 1, etc.).
[0245] Similar to the first type of metadata table, the second type of metadata table may also include a metadata table (e.g., represented by data table A) of a catalog log (e.g., catalog log 1), and a metadata table (e.g., represented by data table Ai) of a data table under a database under a catalog log. Metadata table A may be used to store statistical information of data files of all data tables under catalog log 1. Metadata table Ai may be used to store statistical information of data files of data table i under database under catalog log 1.
[0246] Continue to refer to Figure 2a In S101 of the above, the parameters passed by the computing engine 202 to the writeCommit interface may also include statistical information of the data file related to the first data table, for example, the statistical information may include the maximum value (max) and / or the minimum value (min) of at least one data column (for example, each data column) of the data file. In some embodiments, the statistical information may also include the value range of at least one data column in the data file. In other embodiments, the statistical information may also include the value of the partition column in the first data table (for example, including the partition name and the partition column value).
[0247] For example, Table 4 is an example of a second type of metadata table when the database management system 205 is an RDBMS. Table 4 is a first metadata table of the second type of a first data table (e.g., data table 1), which can be represented by metadata table A. Data table A1 can be used to store statistical information of each data file of data table 1 under database under catalog 1.
[0248] Path to the data file Data column ID Minimum Maximum F1 0 a b F2 3 c d F3 2 e f … … … …
[0249] Table 4
[0250] In Table 4, the path of the data file is not expanded and displayed, and the specific table item content in the first column may be the storage path of the data file in the file system.
[0251] The organization method of the metadata table of the present application can record the filtering information of the partition and the statistical information of the data columns of the data file, so that the screening of the data file can be pushed down to the database to improve the access speed of the metadata information of the data file.
[0252] Example 2: Reading the metadata table
[0253] Combined with Figure 1a , Figure 1b , Figure 3 The figure is a schematic diagram showing the data processing process of the system of the present application for example.
[0254] like Figure 3 As shown, the process may include the following steps:
[0255] S201 , the computing engine 202 sends a file list acquisition operation to the metadata management service 203 .
[0256] The metadata management service 203 may provide a listFile interface for obtaining a data file list by querying a metadata table in the DB. The process in which the computing engine 202 sends a file list acquisition operation to the metadata management service 203 may specifically be a process in which the computing engine 202 calls the listFile interface.
[0257] Among them, the computing engine 202 can pass in parameters when calling the listFile interface, and the parameters may include path information of the second data table to be queried; optionally, the parameters may also include a second version number; optionally, the parameters may also include a filtering condition for at least one first data column in the second data table.
[0258] Here, the second data table is taken as data table 1 in Example 1 (e.g., student score table 1) for example. The path information may include the name of data table 1, optionally the database to which data table 1 belongs, optionally the database to which data table 1 belongs, and the catalog to which the database belongs. The specific granularity of the path information may be determined by the computing engine 202 and is not limited here. Here, the path of data table 1 is catalog 1 / database.
[0259] When the second version number is not included in the parameter, the metadata management service 203 may use the latest version number in the metadata table related to the second data table (here the first type of metadata table for storing FileGroup) as the second version number here when executing the call request to the listFile interface.
[0260] For example, the first data column is a grade column, and when the computing engine 202 requests to query the data of the student grade table, it carries a screening condition for the grade column to implement screening of the data records of the student grade table. For example, the screening condition is that the value of the grade column is less than 100.
[0261] In some embodiments, the screening condition may be an expression, such as a comparison expression and / or a logical expression.
[0262] For example, the filter condition here is a combination of a comparison expression and a logical expression, specifically C1<100, C1<100AND C1>60, where C1 represents the score column.
[0263] In a possible implementation manner, when the parameters in the listFile interface do not include the second version number and the above-mentioned screening condition for screening the modification records of the data files in the metadata table, after S201, the system may switch to executing Figure 3 S203a to S206a shown.
[0264] S203a, S204a, the metadata management service 203 queries the second metadata table of the first type related to the path information of the second data table from the database management system 205 to obtain the third modification record information of the data file related to the second data table and its third version number, wherein the third version number here is correlated with the third modification record information.
[0265] Continuing with the example of the second data table being data table 1, the second metadata table of the first type here may be table 2 generated in the database management system 205 in the above example 1, or the record in table 1 whose metadata table name is Table 1. The following text will use the second data table of the first type being table 2 as an example for explanation.
[0266] The latest version number in Table 2 is V2. The third modification record information and its third version number obtained here include what the metadata management service 203 queried from Table 2: V1 and its associated FileGroup1 (here Add: F1), and V2 and its associated FileGroup2 (here Add: F1', Delete: F1).
[0267] Optionally, after S204a, the metadata management service 203 may execute S205a, where the metadata management service 203 merges the data files in the third modification record information based on the sorting of the third version numbers to obtain a first data file list.
[0268] Table 2 above is a metadata table generated by taking the computing engine 202 as an example of performing a data table write operation in a COW manner. COW is a data writing method for full update. Therefore, the metadata management service 203 can merge the data files for the third modification record information.
[0269] In Table 2, the data files related to the third modification record information are merged according to the order of the version numbers from back to front (i.e., V2 first, then V1), based on the operation (Add, or Delete) in FileGroup and the operated file. Specifically, data file F1 is added in V1, but deleted in V2, and data file F1' is added in V2. Then, the merged first data file list only includes data file F1'.
[0270] In other embodiments, the metadata table (named Table1) of data table 1 in catalog1 / database, that is, the second metadata table of the first type in S203a, is a metadata table generated by taking the computing engine 202 performing a write operation on the data table in MOR as an example. Figure 2d and Figure 2c (1) and Figure 2c (2) The principle of the Filegroup generated when performing the insert operation and the update operation, the second metadata table of the first type in S203a (ie, Table 1) is as shown in Table 5.
[0271] Table 5 is a metadata table (named Table 1) of data table 1 in catalog 1 / database stored in the database management system by performing a data table write operation in the MOR mode.
[0272]
[0273]
[0274] Table 5
[0275] In Table 5, V1 corresponds to the version number of the transaction for the write-commit operation of the insert operation, and V2 corresponds to the version number of the transaction for the write-commit operation of the update operation. MOR only records in an incremental manner, so the operation corresponding to the update operation deletes the original data and then adds new data. MOR can record the added records and deleted records in different data files respectively. The file name can be used to know what the source file associated with the add and delete operations is. As shown in the two records in Table 5, the files for the newly added records are recorded as Add-F1 and Add-F1', and the data file for the deleted records is recorded as Delete-F1. When reading the first data file list based on Table 5, the metadata management service 203 can return all data files related to F1 as the first data file list to the computing engine 202. The first data file list here includes data files with file names: Add-F1, Add-F1', and Delete-F1. These three data files are associated with the data file F1 through the file names, so that the engine 202 can obtain F1 and Add-F1, Add-F1', and Delete-F1 related to F1 in the storage system 204 based on the first data file list, and merge the data. In this way, the computing engine 202 obtains the data file list belonging to the data table 1 that needs to be accessed. Then, the computing engine 204 can query the data table 1 according to the above screening conditions for the data after the above files are merged, and obtain the data that needs to be accessed in the end.
[0276] After S204a or after S205a, the metadata management service 203 executes S206a.
[0277] S206a, the service 204 sends the first data file list to the computing engine 202.
[0278] When S205a is not included in the process, the first data file list here is a list consisting of all data files related to the third modification record information.
[0279] In another possible implementation, when the parameters in the listFile interface include the second version number for filtering the modification record information of the data files in the metadata table and the above-mentioned filtering conditions, after S201, the system may switch to executing Figure 3 S203b to S206b shown.
[0280] In other embodiments, the parameters in the listFile interface may include the second version number and any one of the above-mentioned screening conditions. The specific principles are similar and will not be repeated here.
[0281] Among them, the process from S203b to S206b is similar to the execution principle of the process from S203a to S206a. The similarities are no longer specifically described in S203b to S206b. For details, please refer to the specific description of the process from S203a to S206a. When describing S203b to S206b later, the main description is the differences from the process from S203a to S206a.
[0282] After S201, S203b, S204b, the metadata management service 203 queries the first type of second metadata table and the second type of second metadata table related to the path information of the second data table from the database management system 205 based on the above-mentioned second version number and the above-mentioned filtering conditions, so as to obtain the fourth modification record information and the fourth version number of the data file related to the second data table from the database management system 205, wherein the fourth version number here is correlated with the fourth modification record information.
[0283] The fourth modification record information is modification record information of a data file in the second metadata table of the first type, and the corresponding data column of the data file related to the fourth modification record information meets the screening condition of the first data column, and its fourth version number is less than the second version number.
[0284] The following description will be continued by taking the case where the second data table is data table 1 in catalog 1 / database, the first type of second metadata table is the above-mentioned table 2, and the above-mentioned table 4 is the second type of second metadata table of data table 1 as an example.
[0285] In S203b, a joint query is required for Table 2 and Table 4, and the query conditions may include that the version number is less than the second version number, and the first data column (eg, score column) C1 satisfies the following screening conditions: C1<100, C1<100ANDC1>60.
[0286] Specifically, the computing engine 202 can generate the above expression according to the query statement of the application 201: C1<100, C1<100AND C1>60. Then, the metadata management service 203 can use the open source component ANTLR to parse the expression (e.g., lexical and grammatical analysis) to determine the object (e.g., data column ID is 0) corresponding to C1 in the above Table 2 and Table 4 or the code logic of the expression of C1. Finally, the metadata management service 203 can convert the converted code logic into an SQL statement for joint query of Table 2 and Table 4 in the database management system 205 to query the fourth modification record information and the fourth version number of the data file whose data column value meets the above screening condition and whose version number is less than the second version number.
[0287] As long as the data file related to the fourth modification record information includes data records that satisfy the screening condition expressed by any one of the two expressions C1<100 or C1<100AND C1>60, the data file belongs to the second data file list described below.
[0288] Optionally, after S204b, the metadata management service 203 may execute S205b, where the metadata management service 203 merges the data files in the fourth modification record information based on the sorting of the fourth version numbers to obtain a second data file list.
[0289] The execution principle of this step is similar to that of S205a, and will not be repeated here.
[0290] After S204b, or after S205b, the metadata management service 203 executes S206b.
[0291] S206b: the service 204 sends the second data file list to the computing engine 202 .
[0292] When S205b is not included in the process, the second data file list here is a list consisting of all data files related to the fourth modification record information.
[0293] The organization method of the metadata table of the present application can record the filtering information of the partition and the statistical information of the data columns of the data file, so that the screening of the data file can be pushed down to the database to improve the access speed of the metadata information of the data file.
[0294] The above Examples 1 and 2 take a single-table transaction as an example to illustrate the data writing process and data reading process of the metadata table of the present application. In a single-table transaction, when the metadata management service 203 writes data to the metadata table, it can perform transaction conflict judgment based on the source version number in the writeCommit interface. The source version number here can be used to identify the current state of the data table (for example, data table 1) corresponding to this write operation when the single-table transaction starts, which is equivalent to identifying which version of the modified data table 1 is used for this write operation, because each modification of the data table 1 can be recorded in the relevant metadata table with the associated version number, and each modification of the data table is recorded in a multi-version manner.
[0295] In a possible implementation, the present application may also provide multi-table transactions (see above for specific definitions).
[0296] In a multi-table transaction, the metadata management service 203 can write the metadata of multiple data tables into the metadata table of each data table. In the above single-table transaction, the source version number is used to identify the current state of the single data table 1 when the single-table transaction starts. Then in a multi-table transaction, the fifth version number of the snapshot object can be used to identify the current state of each data table under the corresponding catalog log when the multi-table transaction starts.
[0297] Specifically, the metadata management service 203 may create a snapshot object (eg, catalog log1-1) for the catalog object (eg, catalog log1) to which the data table to be accessed by the multi-table transaction belongs. The snapshot object is also a type of catalog log object.
[0298] The attribute information of the snapshot object may include information for identifying its parent object (here, catalog 1) and a fifth version number, which is the fifth version number assigned to the multi-table transaction by the metadata management service 203 when creating the multi-table transaction.
[0299] The strategy of assigning version numbers to multi-table transactions in transaction 203 is the same as the strategy of assigning version numbers described in Examples 1 and 2, which is to increment the version number in catalog log 1.
[0300] For example, the metadata management service 203 performs a transaction related to metadata operations on a data table in catalog 1, and the latest version number assigned is V4. This time, the fifth version number V5 can be incremented based on V4 to be used as the version number of the multi-table transaction when starting the transaction.
[0301] In this way, the metadata information (such as FileGroup) with a version number less than V5 recorded in the metadata table of catalog log1 can be used as the metadata information referenced by the metadata table of catalog log1-1.
[0302] Combine the following Figure 4 To describe the processing of multi-table transactions.
[0303] Figure 4 (1) may correspond to the metadata table of catalog 1 stored in the database management system 205;
[0304] Figure 4 (2) a metadata table (named Table 1) that may correspond to data table 1 in catalog 1 / database stored in a database management system;
[0305] Figure 4(3) A metadata table (named Table 2) that may correspond to data table 2 in catalog 1 / database stored in a database management system.
[0306] Before time t5, that is, before the creation of the above-mentioned multi-table transaction 1, the metadata table of catalog log1 is as shown in Table 1 of Example 1, the above-mentioned Table 1 in catalog log1 is as shown in Table 2 in Example 1, and the storage content of the above-mentioned Table 2 in catalog log1 is the same as the first two data columns (version number, FileGroup) of the third record and the fourth record in Table 1, which are not shown here.
[0307] Before time t5, transactions with version numbers V1 to V4 have been completed and committed successfully, thereby generating the metadata table of catalog 1 (e.g., Table 1), the metadata table of data table 1 in catalog 1 (e.g., Table 2), and the metadata table of data table 2 in catalog 1. For an introduction to the version numbers and related FileGroups before time t5, refer to Example 1. Figure 2d (The specific principles are similar and will not be repeated here).
[0308] In addition, before time t5, each transaction that has been successfully submitted can be a single-table transaction (the specific implementation process can refer to Example 1) or a multi-table transaction (the specific implementation process can refer to the description of the implementation process of multi-table transaction 1), and there is no limitation here.
[0309] At time t5, the metadata management service 203 creates a multi-table transaction 1, so that the multi-table transaction 1 starts. When creating the multi-table transaction 1, the metadata management service 203 can assign the fifth version number to the multi-table transaction 1. For example, as shown in Table 1, at time t5, the latest version number assigned by the metadata management service 203 to the transaction operating each data table in catalog log 1 is V4, and then the version number is incremented on this basis, and the fifth version number can be obtained as V5.
[0310] The specific implementation process of the metadata management service 203 creating the multi-table transaction 1 may be to create a snapshot object of the catalog 1 object, which is catalog 1-1 in this case, and the attribute information of catalog 1-1 may include the version number V5 assigned at the beginning of the multi-table transaction 1 and the identification information of the parent object catalog 1 of catalog 1-1. By recording the identification information of V5 and catalog 1 in the attribute information of the snapshot object catalog 1-1, it is easy to determine which catalog object (here, the catalog 1 object) and which version number (here, V5) of the FileGroup information before is referenced in the metadata table of the catalog 1-1 object (i.e., the FileGroup information corresponding to V1 to V4, respectively).
[0311] In this way, the FileGroup information of all data table objects in catalog log1 whose version number is less than version number V5 (such as the 4 records in Table 1) all belong to the scope of metadata referenced by the snapshot object catalog log1-1, which reduces the overhead of creating transactions.
[0312] In the embodiment of the present application, by creating a snapshot object catalog 1-1 for the catalog 1 object, the source version number of all data tables in the catalog 1 object and the modification record information of all data files of all data tables before the snapshot object is created can be recorded through the attribute information of the snapshot object catalog 1-1, which is conducive to realizing multi-table operations in transactions. In a single-table transaction, the computing engine 202 only needs to carry the source version number of a data table of this operation when calling the writeCommit interface, which can be used to indicate the version after which the single table operation continues to modify the transaction based on which modification of the single data table.
[0313] like Figure 4 (4) to Figure 4 As shown in (6), the multi-table transaction 1 may include starting a transaction, committing a transaction, and a series of statement operations between starting a transaction and committing a transaction.
[0314] Among them, in a series of statements in a multi-table transaction (for example, statements of at least one operation such as insert operation, update operation, delete operation, etc.), after each statement operation, the computing engine 202 can call the writeCommit interface of the metadata management service 203, wherein each statement operation can correspond to a single statement transaction.
[0315] In addition, a series of statements within a multi-table transaction may also include statements for select operations. In this case, the computing engine 202 may call the listFile interface of the metadata management service 203 to query the metadata table within the database management system 205 through the metadata management service 203 to determine the data file list corresponding to the data table to be queried.
[0316] In addition, when the computing engine 202 performs an update operation, the metadata management service 203 can call the listFile interface to return a list of data files related to the data table that the computing engine 202 needs to query to the computing engine 202, so that the computing engine 202 performs an update operation on the records in the data file list.
[0317] In a multi-table transaction, each time the metadata management service 203 receives a call request from the computing engine 202 to the writeCommit interface, it can assign a sub-version number to the single-statement transaction corresponding to the call request, and write the sub-version number and the FileGroup related to this data table write operation into the metadata table of the snapshot object catalog 1-1 in the database management system in association with each other.
[0318] The strategy for increasing the sub-version number is different from the strategy for increasing the version number in the parent object catalog log1 described above. The sub-version number can be increased in the corresponding snapshot object catalog log1-1. Then, the sub-version numbers in transactions between different snapshot objects (for example, catalog log1-1 and catalog log1-2) of the same parent object catalog log1 are independent of each other and do not affect each other.
[0319] exist Figure 4 In (4), time t is used as the sub-version number within the multi-table transaction 1. In other embodiments, other information can also be used as the sub-version number as long as the order of committing operations on one or more data tables within the multi-table transaction (such as calling the writeCommit interface) can be distinguished.
[0320] Among them, in a multi-table transaction, the metadata management service 203 does not need to make a transaction conflict judgment in the multi-table transaction each time it executes a call to the writeCommit interface. It only needs to compare each FileGroup in the metadata table of the snapshot object catalog1-1 corresponding to the current multi-table transaction 1 with the transaction time period corresponding to the multi-table transaction (i.e., the metadata management service 203 can assign a version number V8 to the multi-table transaction, and the version number assignment strategy is the same as described above) in the metadata table of the parent object catalog1. Figure 4FileGroups with version numbers in the range of V5 to V9 are performing transaction conflict judgment.
[0321] In a possible implementation, when multi-table transaction 1 is committed, metadata management service 203 determines Figure 4 The FileGroup with version number between V5 and V8 in the metadata table of the parent object catalog1 shown in (1) is Figure 4 (4) As shown in the snapshot object catalog 1-1, there is no deletion or update of the same data file in the FileGroup in the metadata table, which means there is no transaction that conflicts with the current multi-table transaction 1. Then the metadata management service 203 can associate each FileGroup in the metadata table of catalog 1-1 with the version number V9 assigned when the multi-table transaction 1 is submitted, and store the associated data in the metadata table of catalog 1 (such as the above-mentioned Table 1).
[0322] In a possible implementation, when multi-table transaction 1 is committed, metadata management service 203 determines Figure 4 The FileGroup with version number between V5 and V8 in the metadata table of the parent object catalog1 shown in (1) is Figure 4 (4) If the FileGroup in the metadata table of the snapshot object catalog 1-1 has deleted or updated the same data file, it means that there is a transaction that conflicts with the current multi-table transaction 1. If the multi-table transaction 1 fails to be submitted, the metadata management service 203 returns the information that the multi-table transaction 1 failed to be submitted to the computing engine 203, so that the computing engine 203 rolls back all operations of the multi-table transaction 1.
[0323] In one possible implementation, when performing transaction conflict judgment on multi-table transaction 1, the metadata management service 203 may obtain a mutual exclusion lock (such as an optimistic lock) of the metadata table of the parent object catalog 1, and then perform the specific operations of transaction conflict judgment mentioned in the above implementation, so that during the transaction conflict judgment, other transactions cannot continue to write data to the metadata table of catalog 1, thereby ensuring the accuracy of this transaction conflict judgment.
[0324] In a possible implementation, within a multi-table transaction, the metadata management service 203 or the computing engine 202 calls the listFile interface to request a list of data files (for example, the call request may include: Figure 3When the metadata management service 203 determines that there is no data file list that meets the version number requirement in the metadata table of the snapshot object catalog 1-1, the metadata management service 203 can determine the parent object of the snapshot object, catalog 1, and the version number of the snapshot object when it was created (for example, V5 mentioned above) through the attribute information of the snapshot object catalog 1-1. Then, the metadata management service 203 can query the data file list that meets the corresponding screening condition in the metadata information with a version number less than V5 in the metadata table of catalog 1. In this process, the data file list query operation can be performed on any data table in catalog 1. The specific data table can be determined according to the needs and is not limited here.
[0325] In a possible implementation, within a multi-table transaction, the metadata management service 203 or the computing engine 202 calls the listFile interface to request a list of data files (for example, the call request may include: Figure 3 The second version number mentioned in S201) is the same as the principle of the specific implementation process. Figure 3 The principles of the processes described are the same, the only difference is that, in a multi-table transaction, the metadata management service 203 can query the first metadata information (such as the mutually related version numbers and FileGroup) that meets the version number requirements or screening conditions in the metadata table of the snapshot object catalog1-1. And the metadata management service 203 can determine the parent object of the snapshot object, which is catalog1 in this case, and the version number of the snapshot object when it was created (such as the above-mentioned V5) through the attribute information of the snapshot object catalog1-1. Then, the metadata management service 203 can query the second metadata information (such as the mutually related version numbers and FileGroup) that meets the version number requirements and screening conditions in the metadata information with a version number less than V5 in the metadata table of catalog1. Then, the metadata management service 203 merges the data files of the first metadata information and the second metadata information based on the version number sorting, so as to query the data file list related to the data table requested to be accessed this time.
[0326] It should be understood that during the execution of multi-table transaction 1, there may still be other single-table transactions and / or multi-table transactions (such as multi-table transaction 2) that operate on the data tables in catalog log 1. In this case, the execution principle of multi-table transaction 2 is the same as that of multi-table transaction 1, wherein the sub-version number and FileGroup information generated during the execution of multi-table transaction 2 are associated and stored in the metadata table of catalog log 1-2. Catalog log 1-2 is a snapshot object of the parent object catalog log 1.
[0327] In addition, the metadata table of catalog 1 as the parent object and the metadata table of the snapshot object (such as catalog 1-1, catalog 1-2, etc.) can be different metadata tables, or they can be the same data table but use specific columns to distinguish the metadata of the parent object and the metadata of the snapshot object. There is no limitation here.
[0328] Combine the following Figure 4 Let's elaborate on the implementation process of multi-table transaction 1.
[0329] At time t5, multi-table transaction 1 starts, and metadata management service 203 creates a snapshot object catalog1-1 of multi-table transaction 1, wherein the attribute information of snapshot object catalog1-1 includes the identification information of parent object catalog1 and version number V5 assigned to snapshot object catalog1-1 by metadata management service 203 when multi-table transaction 1 starts (wherein V5 is an incremented version number based on the latest version number assigned by metadata management service 203 to the transaction operating the data table in catalog1).
[0330] At time t5, the metadata table of catalog log1 is as shown in Table 1. At this time, the metadata table of snapshot object catalog log1-1 is empty, but the metadata table of catalog log1-1 references all records with version numbers before V5 in Table 1, that is, the four records with version numbers from V1 to V4 in Table 1 are all referenced in the metadata table of catalog log1-1.
[0331] After the metadata management service 203 assigns version number V5 to the multi-table transaction 1, there are multi-table transactions or single-table transactions in parallel with the multi-table transaction 1, which also operate on data table 1 and data table 2 in catalog log1.
[0332] In multi-table transaction 1, you can perform at least one of the write operations or read operations on any data table in the parent object catalog log1 (for example, data table 1 in catalog log1 / database, data table 2 in catalog log1 / database). Figure 4 The figure shows the insert operation of multi-table transaction 1 on data table 2 and the update operation on data table 1.
[0333] like Figure 4 As shown, after the multi-table transaction 1 starts, the multi-table transaction 1 may include a single statement transaction 1-1 that performs an insert operation on the data table 2 in the catalog log 1, and a single statement transaction 1-2 that performs an update operation on the data table 1 in the catalog log 1. After the single statement transaction 1-1 performs an insert operation on the data table 2 in the catalog log 1, the writeCommit interface of the metadata management service 203 may be called to commit the write operation on the data table 2. The metadata management service 203 assigns the time t7 when the call request for the writeCommit interface is received as a sub-version number to the single statement transaction 1-1, and writes the sub-version number t7 in association with the modification record information of the data file related to this write commit operation into Table 6, so as to write the first record in Table 6 which was originally an empty table. The first record in Table 6 indicates that an insert operation is performed on the data table 2 of the catalog log 1-1 object (specifically, the data table 2 in the catalog log 1 / database), so as to add a data file F4 in the storage system 204, and record the changes of the data files related to this modification of the data table 2.
[0334] Continue to refer to Figure 4 After t7, multi-table transaction 1 continues to execute to execute single-statement transaction 1-2, where single-statement transaction 1-2 indicates an update operation on data table 1 in catalog log 1, and after the operation, a write commit operation is sent to metadata management service 203. Then metadata management service 203 receives the write commit operation after single-statement transaction 1-2 updates data table 1 at time t9, thereby allocating t9 as a sub-version number to single-statement transaction 1-2, and writing sub-version number t9 into table 6 in association with the modification record information of the data file related to this write commit operation, so as to write the second record into table 6 which originally has only one record.
[0335] When the single statement transaction 102 executes the update operation on the data table 1, the listFile interface of the metadata management service 203 may be first called to read in which data file the data record to be updated in the data table 1 is located in the multi-table transaction 1, that is, to obtain the third data file list information of the data table 1. Then, when the metadata management service 203 executes the call to the listFile interface, it may first query whether there is a data file that meets the query condition in the metadata table (e.g., Table 6) of the snapshot object catalog1-1. If not, the metadata management service 203 searches for the data file that meets the query condition in the metadata with a version number less than V5 in the metadata table of the parent object catalog1 of the snapshot object catalog1-1. Then, the computing engine 202 may perform an update operation on the data file that meets the query condition that the metadata management service 203 has queried. After executing the update operation, the computing engine 202 calls the writeCommit interface of the metadata management service 203 to commit the update operation.
[0336] In another possible implementation, Figure 4 In the multi-table transaction 1 shown, the multi-table transaction 1 needs to read the information about the list of all data files of a certain data table (e.g., data table 1) in catalog log 1. For example, when the metadata management service 203 receives the call request to the listFile interface at time t8, it can query all metadata information about data table 1 in the metadata table of catalog log 1-1 (e.g., Table 6) or in the metadata table named catalog log 1-1-Table 1, where t7 and FileGroup (specifically, Add: F4) associated with each other can be found. And the metadata management service 203 can respond to the call request to the listFile interface and query the metadata information about data table 1 with a version number less than V5 in the metadata table of catalog log 1 (e.g., Table 1 or Table 7 below), where FileGroup associated with V1 (here, Add: F1) and FileGroup associated with V2 (here, Add: F1'; Delete: F1) can be found. Then, the metadata management service 203 can sort the above FileGroups associated with t7, V1, and V2 respectively in ascending order of version numbers, thereby obtaining the modification record information of the complete data files generated by the data table 1 in the multi-table transaction 1. In this way, the metadata management service 203 can send the list of related data files of the modification record information of the complete data files of the data table 1 to the computing engine 202.
[0337] Table 6 is a metadata table of the catalog log 1-1 object stored in the database management system during the multi-table transaction 1. The modification records of data files with version numbers less than V5 in the metadata table of catalog log 1 and the modification record information of the data files in Table 6 can constitute the complete modification record information of the data files of the multi-table transaction 1.
[0338]
[0339] Table 6
[0340] Among them, the relationship between the metadata table named catalog log1-1-Table 1 (or catalog log1-1-Table 2) and Table 6 is similar to the relationship between Table 2 and Table 1. The metadata table named catalog log1-1-Table 1 is the metadata table of data table 1 in catalog / database belonging to the catalog log1-1 object stored in the database management system 205 during the execution of the multi-table transaction 1 corresponding to Table 6.
[0341] Continue to refer to Figure 4 At time t10, multi-table transaction 1 is committed, and metadata management service 203 can increment the latest version number assigned to multi-table transaction 1 in catalog log 1 to obtain version number V8, and assign version number V8 to multi-table transaction 1. In multi-table transaction 1, version number V5 has the same function as Figure 2a In the embodiment, the source version number in S101 has a similar function, and the version number V8 is Figure 2a The function of the first version number in S102 in the embodiment is similar.
[0342] like Figure 4 (1) Figure 4 (2) Figure 4 As shown in (3), the metadata management service 203 assigns version number V8 to the multi-table transaction 1 at time t10 when the multi-table transaction 1 is submitted. The reason is that during the period from t5 to t10, that is, during the execution of the multi-table transaction 1, other parallel transactions have successfully submitted the write submission operation on the data table in catalog log 1 by calling the writeCommit interface of the metadata management service 203, so that V6, V7 and their respective related FileGroup information have been written into Table 1, so that the metadata table of catalog log 1 is Table 1 at time t5 when the multi-table transaction 1 starts. However, at time t10 when the multi-table transaction 1 is submitted, the metadata table of catalog log 1 has been updated to the data shown in Table 7.
[0343] Table 7 is a metadata table of catalog log 1 stored in the database management system 205 when the multi-table transaction 1 is submitted:
[0344] Table 7
[0345] Continue to refer to Figure 4 When multi-table transaction 1 is submitted at time t10, metadata management service 203 can perform transaction conflict judgment on the modification record information of data files related to the operation of the data table in catalog log1 in multi-table transaction 1 and the modification record information of data files related to the operation of the data table with version numbers between V5 and V8 in the metadata table of catalog log1 (here is the state shown in Table 7).
[0346] For example, the metadata management service 203 can determine whether there is a deletion record for the same data file between the FileGroup in the last two records of Table 7 (records with version numbers V6 and V7) and the FileGroup in Table 6. If there is a deletion record for the same data file F1', it is determined that there is a transaction that conflicts with the current multi-table transaction 1, and the multi-table transaction 1 fails to be submitted. There is no need to add the data in Table 7 to the metadata table of the parent object catalog 1.
[0347] In another possible implementation, Figure 4 The time t9 is the write commit operation of the update operation of multi-table transaction 1 on data table 2, rather than the write commit operation on the update operation of data table 1. Therefore, during the transaction of multi-table transaction 1, the metadata table of the catalog log1-1 object stored in the database management system is table 6', not the above-mentioned table 6.
[0348]
[0349] Table 6'
[0350] Combined with the above table 6', when the multi-table transaction 1 is submitted, the metadata management service 203 can perform transaction conflict judgment between the above table 6' and the last two records in the metadata table of the parent object catalog 1 (i.e., the above table 7), and can determine that there is no transaction that conflicts with the current multi-table transaction. Then the multi-table transaction 1 is submitted successfully at time t10.
[0351] Then, when the multi-table transaction 1 is successfully submitted, the metadata management service 203 can write all FileGroups in Table 6' in the order of the child version number and associate them with the version number V8 assigned when the multi-table transaction 1 is submitted to the metadata table of the parent object catalog1 (i.e., write them into Table 7), thereby obtaining the updated metadata table of catalog1 (as shown in Table 8 here); similarly, when the multi-table transaction 1 is successfully submitted, the metadata management service 203 can also associate all records in the metadata table of the catalog1-1 object named catalog1-1-Table2 with the version number V8, and write them into the metadata table of data table 1 associated with catalog1 (named Table2).
[0352] Table 8 is the metadata table of catalog log 1 updated in the database management system 205 after the multi-table transaction 1 is submitted:
[0353]
[0354] Table 8
[0355] In an embodiment of the present application, when performing multi-table operations within a transaction, the present application can provide a multi-table transaction. When creating a multi-table transaction, a snapshot object catalog log1-1 of the parent object of the data table to be operated (such as catalog log1 in the above example, or a database object) can be created, and the version number assigned at the start of the multi-table transaction and the information of the parent object of the snapshot object can be recorded (which can be recorded as attribute information of the snapshot object). In this way, the modification basis of all data tables in catalog log1 at the start of the multi-table transaction can be recorded with the version number assigned when the snapshot object is created, and the operation of multiple data tables can be realized in the same catalog log or the same database. In this way, the present application can provide not only single-table transactions, but also multi-table transactions, which are widely used in business scenarios.
[0356] In addition, whether it is a single-table transaction or a multi-table transaction, for the data table in the same catalog log or the same database, the metadata management service 203 of the present application can record the modification of the data file in the database in a multi-version manner, so that each modification of the data table can correspond to a version number and a modification record of the data file. It can be achieved that each modification of the data table has a record, thereby realizing the storage of metadata of the data file. In addition, the present application can also be combined with a database lock mechanism to ensure that the judgment of transaction conflicts is accurate, and file-level conflict detection between different transactions can be realized (uncommitted transactions involve modification or deletion of the same data file as committed transactions, then the uncommitted transaction is judged as a conflict, and the uncommitted transaction fails to commit), solving the data consistency problem in concurrent scenarios.
[0357] Compared to the solution in the related art that stores the metadata of a data table (for example, in which data files the data of the data table is stored) in the file system in the form of a file, the present application records the metadata information of the data table in a metadata table in the database, and records the file modification record information related to each modification of the data table in the metadata table in a multi-version manner. In this way, when accessing the metadata of the data table, it can be achieved directly by accessing the metadata table in the database, without using the file system for metadata access, thereby reducing memory usage, improving the access speed of metadata information, reducing the access overhead to metadata, and having higher data performance and faster speed for the data table.
[0358] Moreover, in the data lake table format in the related art, the storage of metadata depends on the file system, but not all types of file systems support the storage of metadata, which limits the application scenarios. The metadata of this application is directly stored in the database, does not depend on the file system, and has no restrictions on application scenarios.
[0359] In addition, in the data lake table format in the related art, the statistical information of the data file is recorded in the file system in the form of a file. When the statistical information is used to filter the data file, it is necessary to open the file on the underlying storage to read the statistical information to complete the filtering of the data file. Obviously, the overhead is large when filtering the data file, which reduces the filtering performance of the data file. However, in the embodiment of the present application, the statistical information of the data file (such as the maximum value, minimum value, partition information, etc. of the data column) can also be recorded in the form of a table in the database. Then, when filtering the data file to be accessed, the file filtering can be pushed down to the database, thereby improving the access speed and filtering speed of the metadata of the data file.
[0360] In a possible implementation, the service 203 of the present application may include a transaction management module, an index management module, a schema module, and an automatic optimization module.
[0361] Among them, the transaction management module can be used for version number allocation, transaction conflict judgment, transaction status recording, etc.
[0362] The index management module can be used to store statistical information and partition information of data files.
[0363] The automatic optimization module can be used to merge small data files and improve the performance of file operations.
[0364] The Table Schema module can be used to store table schema information, which is used to describe the storage method, attribute information, relationship, logical structure, etc. of data tables, objects, fields, etc. Table schema information can be defined by users.
[0365] In a possible implementation, an embodiment of the present application provides a metadata management device. The device includes: a first determination module, used to determine the source version number of the first transaction at the beginning of a first transaction, wherein the first transaction is used to perform at least one write operation on at least one first data table in a data lake; wherein the source version number is used to indicate the latest version number associated with each first data table stored in a first metadata table in a database management system; wherein the first metadata table includes a version number assigned to a second transaction and modification record information of a data file associated with the second transaction, wherein the second transaction is used to operate a data file of a data table in the data lake, and the second transaction is a transaction that has been successfully submitted; a first acquisition module, used to obtain first modification record information of a data file associated with each of the write operations; a second determination module, used to assign a first version number to the first transaction when the first transaction is submitted, and determine that there is no second modification record information in the first metadata table with a version number between the source version number and the first version number, wherein the second modification record information is modification record information of a data file that deletes or modifies the same data file as the first modification record information; a first writing module, used to write the first version number and the first modification record information to the first metadata table in association.
[0366] In a possible implementation, the device also includes: a third determination module, used to determine the parent object of the at least one first data table and create a snapshot object of the parent object when the first transaction starts; wherein the attribute information of the snapshot object includes information for identifying the parent object and the source version number; wherein the source version number is the version number assigned to the first transaction when the first transaction starts; and the first metadata table is used to store modification record information of data files related to the parent object.
[0367] In a possible implementation, the device further includes: a second writing module, used to write first modification record information of the data file associated with each write operation to a second metadata table in the database management system during the execution of the first transaction; wherein the second metadata table is used to store modification record information of the data file associated with the snapshot object.
[0368] In a possible implementation, the first writing module is specifically configured to write the first version number and the first modification record information stored in the second metadata table into the first metadata table in association with each other.
[0369] In a possible implementation, the device further includes: a first query module, used to query the second metadata table for third modification record information of data files related to the first data table during execution of the first transaction, and to query the first metadata table for fourth modification record information of data files whose version numbers are less than the source version number and are related to the first data table, wherein the first transaction is also used to perform a read operation on the first data table; and a fourth determination module, used to determine a first data file list related to the first data table based on the third modification record information and the fourth modification record information.
[0370] In a possible implementation, the device further includes: a fifth determination module, which is used to, during the execution of the first transaction, when it is determined that no modification record information of the data file related to the first data table is found in the second metadata table, query the first metadata table for fourth modification record information of the data file whose version number is less than the source version number and is related to the first data table, wherein the first transaction is also used to perform a read operation on the first data table; and a second acquisition module, which is used to acquire a second data file list related to the first data table based on the fourth modification record information.
[0371] In a possible implementation manner, the device further includes: a locking module, configured to lock the first metadata table.
[0372] In a possible implementation, the device also includes: a third acquisition module, used to obtain data statistical information of data files respectively related to each of the first data tables when the first transaction is committed; a third writing module, used to write the data statistical information to a third metadata table related to the first data table in the database management system.
[0373] In a possible implementation, the device further includes: a second query module, used to query the first metadata table and the third metadata table based on a filtering condition during the execution of the third transaction, and obtain a list of third data files related to the first data table that meet the filtering condition; wherein the third transaction is used to perform a read operation on the first data table, and the read operation includes the filtering condition for the data records to be read.
[0374] The effects and implementation methods of the metadata management devices of the above-mentioned embodiments are similar to the effects of the methods of the above-mentioned embodiments, and will not be described in detail here.
[0375] The following describes a device provided by an embodiment of the present application. Figure 5 As shown:
[0376] Figure 5 The schematic diagram of the structure of a metadata management device provided in an embodiment of the present application is as follows. Figure 5 As shown, the device 500 may include: a processor 501 , a transceiver 505 , and optionally a memory 502 .
[0377] The transceiver 505 may be referred to as a transceiver unit, a transceiver, or a transceiver circuit, etc., and may be used to implement a transceiver function. The transceiver 505 may include a receiver and a transmitter, wherein the receiver may be referred to as a receiver or a receiving circuit, etc., and may be used to implement a receiving function; and the transmitter may be referred to as a transmitter or a transmitting circuit, etc., and may be used to implement a transmitting function.
[0378] 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 metadata management method 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).
[0379] 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.
[0380] 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.
[0381] Exemplarily, the structure of the metadata management device may not be affected by Figure 5 The metadata management device may be an independent device or may be a part of a larger device. For example, the implementation form of the metadata management device may be:
[0382] (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.
[0383] For the case where the metadata management device is implemented in the form of a chip or a chip system, see Figure 6 Schematic diagram of the chip structure shown. Figure 6 The chip shown includes a processor 601 and an interface 602 . The number of the processor 601 may be one or more, and the number of the interface 602 may be multiple. Optionally, the chip or chip system may include a memory 603 .
[0384] 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.
[0385] 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.
[0386] 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.
[0387] 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.
[0388] 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.
[0389] 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 On ly Memory, ROM), an erasable programmable read-only memory (Erasable Programmable ROM, EPROM), an electrically erasable programmable read-only memory (Electric ica l ly EPROM, EEPROM), a register, a hard disk, a mobile hard disk, a CD-ROM (CD-ROM) or any other form of storage medium well 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.
[0390] 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.
[0391] 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
1. A metadata management method, characterized in that: Applied to a computing node in a data center, the method comprises: At the start of a first transaction, determining a source version number of the first transaction, wherein the first transaction is used to perform at least one write operation on at least one first data table in the data lake; The source version number is used to indicate the latest version number associated with each of the first data tables stored in the first metadata table in the database management system; The first metadata table includes a version number assigned to a second transaction and modification record information of a data file related to the second transaction, wherein the second transaction is used to operate a data file of a data table in the data lake, and the second transaction is a successfully submitted transaction; Acquire first modification record information of the data file associated with each of the write operations; When the first transaction is committed, a first version number is assigned to the first transaction, and it is determined that no second modification record information having a version number between the source version number and the first version number exists in the first metadata table, wherein the second modification record information is modification record information of a data file in which the same data file as the first modification record information is deleted or modified; The first version number and the first modification record information are written into the first metadata table in association.
2. The method according to claim 1, characterized in that The method further comprises: When the first transaction starts, determining the parent object of the at least one first data table, and creating a snapshot object of the parent object; The attribute information of the snapshot object includes information for identifying the parent object and the source version number; The source version number is a version number assigned to the first transaction when the first transaction starts; The first metadata table is used to store modification record information of data files related to the parent object.
3. The method according to claim 2, characterized in that The method further comprises: During the execution of the first transaction, first modification record information of the data file associated with each write operation is written into a second metadata table in the database management system; The second metadata table is used to store modification record information of data files related to the snapshot object.
4. The method according to claim 3, characterized in that The step of writing the first version number and the first modification record information into the first metadata table in association with each other includes: The first version number and the first modification record information stored in the second metadata table are written into the first metadata table in association with each other.
5. The method according to any one of claims 2 to 4, characterized in that The first transaction is also used to perform a read operation on the first data table. The method further includes: During the execution of the first transaction, querying the second metadata table for third modification record information of data files related to the first data table, and querying the first metadata table for fourth modification record information of data files with a version number less than the source version number and related to the first data table; Based on the third modification record information and the fourth modification record information, a first data file list related to the first data table is determined.
6. The method according to any one of claims 2 to 4, characterized in that The first transaction is also used to perform a read operation on the first data table. The method further includes: During the execution of the first transaction, when it is determined that no modification record information of the data file related to the first data table is queried in the second metadata table, querying the first metadata table for fourth modification record information of the data file having a version number less than the source version number and related to the first data table; Based on the fourth modification record information, a second data file list related to the first data table is obtained.
7. The method according to any one of claims 1 to 6, characterized in that: Before determining that there is no second modification record information with a version number between the source version number and the first version number in the first metadata table, the method further includes: The first metadata table is locked.
8. The method according to any one of claims 1 to 7, characterized in that The method further comprises: When the first transaction is committed, obtaining data statistical information of data files respectively related to each of the first data tables; The data statistical information is written into a third metadata table related to the first data table in the database management system.
9. The method according to claim 8, characterized in that The method further comprises: During the execution of the third transaction, based on the screening condition, query the first metadata table and the third metadata table to obtain a list of third data files related to the first data table that meet the screening condition; The third transaction is used to perform a read operation on the first data table, and the read operation includes the screening condition for the data record to be read.
10. A metadata management device, characterized in that: The metadata management device comprises: A first determination module, configured to determine a source version number of a first transaction when the first transaction starts, wherein the first transaction is used to perform at least one write operation on at least one first data table in the data lake; The source version number is used to indicate the latest version number associated with each of the first data tables stored in the first metadata table in the database management system; The first metadata table includes a version number assigned to a second transaction and modification record information of a data file related to the second transaction, wherein the second transaction is used to operate a data file of a data table in the data lake, and the second transaction is a successfully submitted transaction; A first acquisition module, used for acquiring first modification record information of the data file related to each write operation; a second determination module, configured to assign a first version number to the first transaction when the first transaction is committed, and to determine that there is no second modification record information in the first metadata table having a version number between the source version number and the first version number, wherein the second modification record information is modification record information of a data file in which the same data file as the first modification record information is deleted or modified; The first writing module is used to write the first version number and the first modification record information into the first metadata table in association with each other.
11. The device according to claim 10, characterized in that The device also includes: a third determination module, configured to determine, when the first transaction starts, a parent object of the at least one first data table and create a snapshot object of the parent object; The attribute information of the snapshot object includes information for identifying the parent object and the source version number; The source version number is a version number assigned to the first transaction when the first transaction starts; The first metadata table is used to store modification record information of data files related to the parent object.
12. The device according to claim 11, characterized in that The device also includes: A second writing module is used to write first modification record information of the data file related to each write operation into a second metadata table in the database management system during the execution of the first transaction; The second metadata table is used to store modification record information of data files related to the snapshot object.
13. The device according to claim 12, characterized in that The first writing module is specifically configured to write the first version number and the first modification record information stored in the second metadata table into the first metadata table in association with each other.
14. The device according to any one of claims 11 to 13, characterized in that The device also includes: a first query module, configured to query the second metadata table for third modification record information of data files related to the first data table, and query the first metadata table for fourth modification record information of data files related to the first data table whose version numbers are smaller than the source version number, during the execution of the first transaction, wherein the first transaction is also used to perform a read operation on the first data table; The fourth determining module is used to determine a first data file list related to the first data table based on the third modification record information and the fourth modification record information.
15. The device according to any one of claims 11 to 13, characterized in that The device also includes: a fifth determining module, configured to, when determining that modification record information of a data file related to the first data table is not found in the second metadata table during the execution of the first transaction, query the first metadata table for fourth modification record information of a data file related to the first data table whose version number is less than the source version number, wherein the first transaction is also used to perform a read operation on the first data table; The second acquisition module is used to acquire a second data file list related to the first data table based on the fourth modification record information.
16. The device according to any one of claims 10 to 15, characterized in that The device also includes: A locking module is used to lock the first metadata table.
17. The device according to any one of claims 10 to 16, characterized in that The device also includes: A third acquisition module, configured to acquire data statistical information of data files respectively related to each of the first data tables when the first transaction is committed; The third writing module is used to write the data statistical information into a third metadata table related to the first data table in the database management system.
18. The device according to claim 17, characterized in that The device also includes: A second query module is used to query the first metadata table and the third metadata table based on a screening condition during the execution of the third transaction, and obtain a list of third data files related to the first data table that meet the screening condition; The third transaction is used to perform a read operation on the first data table, and the read operation includes the screening condition for the data record to be read.
19. A computer-readable storage medium, characterized in that: The method comprises a computer program, which, when running on a computer or a processor, enables the computer or the processor to execute the method according to any one of claims 1 to 9.
20. A metadata management device, 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 claimed in any one of claims 1 to 9.
21. 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 9 are performed.
