Big data cloud storage method that meets ACID properties

By adopting transaction log processing and serialization methods in big data cloud storage, the problem of ACID transactional and high-performance operations in object storage is solved, and multi-object updates at one time and read-write concurrency performance are improved.

CN118277458BActive Publication Date: 2024-08-30HUATENG DIGITAL CLOUD (BEIJING) TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202410712758.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-06-04
Publication Date
2024-08-30
Estimated Expiration
2044-06-04

AI Technical Summary

Technical Problem

Existing big data cloud storage technology cannot guarantee ACID transactional and high-performance operations. Especially when storing relational data in object storage, multi-object update operations are not atomic and there is a lack of isolation between query operations, resulting in the reading client only querying When a partial update occurs, if the object update fails, the entire object needs to be rolled back.

Method used

Adopt a big data cloud storage method that satisfies ACID properties. By receiving user operation requests, obtain transaction logs, process objects to be operated, generate update objects, write transaction logs concurrently, store them in table-level directories, and set checkpoints for Spark Parallel processing, data conflict detection, ensuring serialization and frequency settings of transaction logs, and achieving one update of multiple objects.

Benefits of technology

By storing transaction logs and serialization of log records, the information between data objects and tables is maintained, enabling clients to update multiple objects in a serialized manner, maintaining read and write concurrency performance, and ensuring ACID transactional and high-performance operations.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118277458B
    Figure CN118277458B
Patent Text Reader

Abstract

The present application discloses a big data cloud storage method that meets ACID properties, including: receiving a user's operation request for a cloud storage object; obtaining the most recent R-th version of the transaction log; searching for the corresponding object to be operated from a storage file in Parquet format according to the R-th version of the transaction log; processing the object to be operated according to the operation request and generating an update object; generating the R+1th version of the transaction log to be written; concurrently writing the R+1th version of the transaction log to be written to the log record to generate the R+1th version of the transaction log. Wherein, the R-th version of the transaction log and the R+1th version of the transaction log are stored in a table-level directory; the object is stored in a partitioned directory. The present application maintains the information between data objects and data tables through the transaction log records stored in the cloud objects, the serialization of the log records, and the checkpoints set at a preset frequency, so as to better ensure ACID transactional properties and high-performance operations.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of database cloud storage technology, and in particular to a big data cloud storage method that meets ACID properties. Background Art

[0002] Big data cloud storage technology is a network online storage model, that is, data and files are stored on the Internet through cloud computing service providers, and users access these data and files through the public Internet or private network connections.

[0003] There are three main types of cloud storage: object storage, file storage, and block storage. In order to better manage object databases, the support of database management systems is usually required.

[0004] In a database system, a complete logical process consisting of a series of database operations that meet the ACID property is called a transaction. For example, in a bank transfer, the sum of the two database operations of deducting the amount from the original account and adding the amount to the target account constitutes a complete logical process that cannot be split. This process is called a transaction and has ACID properties.

[0005] In the process of implementing the prior art, the inventors found that: since the essence of object storage implementation is key-value storage, there is no cross-key consistency guarantee. The most common way to store relational data in cloud storage objects is column storage format. Each table is stored as a collection of a series of objects, partitioned by certain columns. This makes it difficult to ensure ACID transactional and high-performance operations in some scenarios. Specifically, the update operation of multiple objects is not atomic, and there is no isolation between query operations. If a query operation needs to update multiple objects in the table, since it is an object-by-object update, the reading client (reader) will only query part of the update; if the update of an object fails, the rollback requires an overall rollback.

[0006] Therefore, there is a need to provide a big data cloud storage method that can better guarantee ACID transactional and high-performance operations. Summary of the invention

[0007] The embodiment of the present application provides a big data cloud storage method that meets ACID properties, so as to better ensure ACID transactional and high-performance operations.

[0008] Specifically, a big data cloud storage method that meets ACID properties includes the following steps:

[0009] Receiving a user's operation request for a cloud storage object;

[0010] Get the most recent R version of the transaction log;

[0011] According to the transaction log of version R, find the corresponding object to be operated from the storage file in Parquet format;

[0012] According to the operation request, process the object to be operated and generate the update object;

[0013] Generate the R+1th version of the transaction log to be written;

[0014] Concurrently, the R+1th version of the transaction log to be written is written to the log record to generate the R+1th version of the transaction log;

[0015] The Rth version transaction log and the R+1th version transaction log are stored in the table-level directory;

[0016] The objects are stored in a partition directory manner.

[0017] Furthermore, the method further comprises:

[0018] When the concurrent execution fails to write the R+1 version of the transaction log to be written into the log record and generate the R+1 version of the transaction log:

[0019] Get the most recent R+1 version of the transaction log;

[0020] According to the R+1 version of the transaction log, search for the corresponding object to be operated from the storage file in Parquet format;

[0021] According to the operation request, process the object to be operated and generate the update object;

[0022] Generate the R+2 version of the transaction log to be written;

[0023] Concurrently, the R+2 version of the transaction log to be written is written to the log record to generate the R+2 version of the transaction log.

[0024] Furthermore, the method further comprises:

[0025] Take a photo of the R+1 version of the transaction log to generate a log record snapshot.

[0026] Furthermore, the R+1 version of the transaction log is photographed to generate a log record snapshot, including:

[0027] A log record snapshot is generated once every N versions of the transaction log.

[0028] Furthermore, the method also includes setting storage checkpoints at a preset frequency so as to perform vectorized processing in parallel using Spark.

[0029] Furthermore, the checkpoint includes the most recent checkpoint, and the most recent checkpoint is stored in a table-level directory.

[0030] Furthermore, the log records are sorted according to a preset attribute key value range, and the operation request is configured to include an object attribute key value range.

[0031] Furthermore, the transaction log and the object are both stored in the cloud.

[0032] Furthermore, the transaction log is in JSON format.

[0033] Furthermore, concurrently writing the R+1th version of the transaction log to be written into the log record to generate the R+1th version of the transaction log also includes:

[0034] When writing to the log record, perform data conflict detection on the object;

[0035] When the object's data conflicts, an exception notification is returned.

[0036] The embodiments provided by the present application have at least the following beneficial effects: through transaction log records stored in cloud objects, as well as serialization of log records and checkpoints set at a preset frequency, information between data objects and data tables is maintained, so that the client can update multiple objects at a time in a serialized manner, while maintaining the concurrency performance of reading and writing files, thereby better ensuring ACID transactionality and high-performance operations. BRIEF DESCRIPTION OF THE DRAWINGS

[0037] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:

[0038] Figure 1 A flowchart of a big data cloud storage method that meets ACID properties is provided in an embodiment of the present application. DETAILED DESCRIPTION

[0039] In order to make the purpose, technical solution and advantages of the present application clearer, the technical solution of the present application will be clearly and completely described below in combination with the specific embodiments of the present application and the corresponding drawings. Obviously, the described embodiments are only 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 making creative work are within the scope of protection of the present application.

[0040] There are three main types of cloud storage: object storage, file storage, and block storage. Among them, object storage is a data storage architecture for storing large amounts of unstructured data. In the object storage model, objects are not organized in a file or folder hierarchy, but are stored in a secure bucket with nearly unlimited scalability. In the object storage model, each piece of unstructured data stored in it is abstracted into an "object", and an object is mainly composed of four parts: key name (Key): used to identify the name of the object; key value (Value): used to store the content data of the object; access control list (ACL): used to identify which users or user groups can access the object; metadata (Metadata): used to store other additional information of the object in the form of Key-Value, such as the MD5 checksum of the object content, the owner of the object (owner), access time (atime), creation time (ctime), modification time (mtime), etc. Metadata can be customized to identify object properties and specify how to handle objects when accessing them, making data easier to access and analyze. Object storage has great advantages in realizing the storage of data warehouses and data lakes, and the cost of storing large amounts of data is also lower.

[0041] A database management system (DBMS) is a large-scale computer software management system designed for object databases and for managing databases. Database managers usually use database management systems to create database systems. In the process of writing or updating data, a database management system (DBMS) must have four properties, collectively referred to as ACID properties, to ensure that transactions are correct and reliable. They include:

[0042] 1. Atomicity (also known as indivisibility): All operations in a transaction are either completed or not completed, and will not end at a certain stage in the middle. If an error occurs during the execution of a transaction, it will be rolled back to the state before the transaction started, as if the transaction had never been executed. That is, the transaction is indivisible and irreducible.

[0043] 2. Consistency: This means that the integrity of the database is not destroyed before and after the transaction begins. This means that the written data must fully comply with all preset constraints, triggers, and cascading rollbacks.

[0044] 3. Isolation (also known as independence): The ability of a database to allow multiple concurrent transactions to read, write and modify its data at the same time. Isolation can prevent data inconsistency caused by cross-execution when multiple transactions are executed concurrently. Transaction isolation is divided into different levels.

[0045] 4. Durability, that is, after the transaction is completed, the changes to the data are permanent and will not be lost even if the system fails.

[0046] Please refer to Figure 1 , this application discloses a big data cloud storage method that meets ACID properties, including:

[0047] Step S100: receiving a user's operation request for a cloud storage object.

[0048] Specifically, the user sends an operation request for a cloud storage object to the cloud storage database management system to instruct the cloud storage database management system to perform a series of operations on the data in the database, including reading data, writing data, updating or modifying data, deleting data, etc. The cloud storage database management system receives the user's operation request for the cloud storage object.

[0049] It is worth noting that different database management systems have different operation instruction statements. The operation request in the embodiment of the present application can be implemented based on various existing database management systems, such as Oracle, Microsoft SQL Server, Access, MySQL, and PostgreSQL. The implementation of the technical solution of the present application is not limited by which database management system is implemented.

[0050] Step S200: Obtain the most recent R-th version of the transaction log.

[0051] A database transaction is a logical unit of execution in a database management system, consisting of a finite sequence of database operations. A transaction log is a file separate from the database file. It stores all changes made to the database, and all inserts, updates, deletes, commits, rollbacks, and database schema changes are recorded. Transaction logs are also called roll-forward logs or redo logs. Transaction logs are an important part of backup and recovery, and are also required for data synchronization or replication. Running a database with a transaction log provides greater fault protection, better performance, and data replication.

[0052] Specifically, in an implementation mode provided in the present application, the log contains metadata information maintained for each data file, all metadata are stored in the underlying object storage, and transactions are implemented through an optimistic concurrency protocol for the object storage.

[0053] Transaction logs are stored in database tables. Each transaction log record object contains an array of operations performed on the previous version of the table to generate the next version. Transaction log records are numbered in order, starting with 0 and increasing in sequence, as the ID number of each version. Version control of transaction logs can be achieved through the MVCC multi-version control protocol.

[0054] Available operations include insert, update, delete, commit, rollback, and database schema changes. Available operations also include changing metadata. Usually, the first version of a table must include metadata operations, and subsequent metadata operations will completely overwrite the current metadata of the table. Metadata is a data structure that includes: schema, partition column names, storage format of data files, and other configuration options.

[0055] In one embodiment provided by the present application, a table record can be modified by adding or deleting a single data object. The client can search the log to find all added objects that have not been deleted and determine the set of objects that make up the table. Additions can contain statistical information, deletions contain a timestamp when the deletion occurred, and a delay time can be set. Each log record object can also include source information in the operation. Custom operations with application fields and version fields can also be written into the log record object, so that the log object can be used to track application-specific information.

[0056] When the cloud storage database management system receives an operation request from a user for a cloud storage object, it can obtain the Rth version (log record ID is R) of the transaction log closest to the current operation request in the transaction log through a table read operation.

[0057] Step S300: According to the Rth version transaction log, search for the corresponding object to be operated from the storage file in Parquet format.

[0058] Parquet format is a column-based storage format that supports nested structures. Traditional relational databases use row-based storage, and the data in a row is stored in a continuous form in the storage medium. For distributed databases, data warehouses, data lakes and other application scenarios, row-based databases need to establish indexes and materialized views, which takes a lot of time and resources, resulting in low query performance and high maintenance costs. Therefore, emerging distributed databases, data warehouses, data lakes and other application scenarios mostly use column-based storage, that is, the data in a column is stored in a continuous form in the storage medium. Parquet is currently a mainstream column-based storage format. It is independent of programming languages ​​and is not bound to any data processing framework. It is compatible with multiple languages ​​and components, including various mainstream query engines, computing frameworks and data models, so it can be integrated with any project and is widely used.

[0059] Specifically, the contents of a table are stored in Apache Parquet objects. Each data object has a unique name. Usually, when writing transaction-related data objects to a data table, a GUID is used to generate the object name. Whether an object is a certain version of a table is determined by the transaction log. Based on the Rth version of the transaction log, the corresponding object to be operated can be found in the object storage table.

[0060] Step S400: According to the operation request, the object to be operated is processed to generate an update object.

[0061] Specifically, after the cloud storage database management system finds the corresponding object to be operated, it can complete a series of operation processing on the object to be operated according to the operation request for the cloud storage object sent by the user to the cloud storage database management system. After the operation processing is completed, an update object is generated, and the corresponding object to be operated is updated to the latest state.

[0062] Step S500: Generate the R+1th version of the transaction log to be written.

[0063] Specifically, after the update object is generated, based on its latest state, an R+1th version of the transaction log to be written corresponding to its latest state is generated.

[0064] Step S600: Concurrently write the R+1th version of the transaction log to be written into the log record to generate the R+1th version of the transaction log.

[0065] Specifically, after the R+1 version of the transaction log to be written is generated, it is written to the log record through the concurrent mode to generate the R+1 version of the transaction log. It is understandable that the database allows concurrent execution of transactions in order to improve resource utilization and transaction execution efficiency and reduce response time. In an embodiment provided by the present application, transaction concurrency control can be performed through an optimistic concurrency control mechanism. That is, it is assumed that multi-user concurrent transactions will not affect each other during processing, and each transaction can process the part of the data affected by each transaction without generating locks. Before submitting data updates, each transaction will first check whether other transactions have modified the data after the transaction reads the data. If other transactions are updated, the transaction being submitted will be rolled back. Specifically, in the process of writing and modifying the table, first, optimistically write out a new data file or modify a copy of the existing data file, and then commit the transaction, and create the latest atomic version of the table by adding a new entry to the log. In this log entry, it is recorded which data files are to be logically added and deleted, as well as changes to other metadata related to the table. The retention period can also be preset or specified by the user. After the retention period, the expired data files will be deleted.

[0066] By serializing and recording the transaction log version and taking photos, data snapshots can be queried according to time nodes, and rollback can be performed according to time nodes to achieve time travel. Through operations such as insert, update, delete, commit, rollback, and database mode changes, related objects can be efficiently rewritten to achieve streaming updates of stored data. Small objects can be written to the table through streaming operations and merged and updated in a transactional manner, thereby supporting incremental consumption.

[0067] The Rth version transaction log and the R+1th version transaction log are stored in the table-level directory;

[0068] The objects are stored in a partition directory manner.

[0069] Specifically, in one embodiment provided in the present application, transaction logs are stored in the form of object storage tables. An object storage table is a directory on a cloud object storage or file system. Each table is stored in a file system directory, or in an object storage with the same directory as a key prefix, which contains data objects with table content and transaction operation logs. The client uses a control protocol customized based on the characteristics of cloud object storage to update the data structure. The contents of the table are stored in Apache Parquet objects, which can be organized into directories using Hive's partition naming conventions, storing tables as object collections, and partitioning records into directories based on one or more attributes. For example, for a table with a date field, a separate object directory can be created for each date. The incoming data is then split into multiple objects based on the date field. Such partitioning reduces the cost of query read operations that operate or access certain partitions.

[0070] It is understandable that by storing data in partition directories in Parquet format, and then maintaining historical version data by recording table versions and change histories in pre-written transaction logs, the efficiency of operations can be improved and data consistency can be maintained. Some table-level operations in object storage, such as updating metadata, updating table names, changing schemas, adding or deleting partitions, adding or removing files, etc., will store all operations in table-level directories in the form of logs, which can more efficiently achieve data synchronization and client access and read and write transaction logs.

[0071] Further, in a preferred implementation manner provided by the present application, the method further comprises: when the step of concurrently writing the R+1 version of the transaction log to be written into the log record to generate the R+1 version of the transaction log fails:

[0072] Get the most recent R+1 version of the transaction log;

[0073] According to the R+1 version of the transaction log, search for the corresponding object to be operated from the storage file in Parquet format;

[0074] According to the operation request, process the object to be operated and generate the update object;

[0075] Generate the R+2 version of the transaction log to be written;

[0076] Concurrently, the R+2 version of the transaction log to be written is written to the log record to generate the R+2 version of the transaction log.

[0077] It is understandable that when the execution concurrently writes the R+1 version of the transaction log to be written into the log record and generates the R+1 version of the transaction log, other users may concurrently operate on the operation object and have written and generated the R+1 version of the transaction log, resulting in the failure of this execution.

[0078] In this case, the latest transaction log corresponding to the current execution step is updated to the R+1 version. Therefore, according to the aforementioned steps S200-S500, the operation and update steps are re-executed with the R+1 version of the transaction log as the latest transaction log. The execution of the relevant steps is consistent with the specific description of the aforementioned content, and will not be repeated here.

[0079] Furthermore, in a preferred embodiment provided in the present application, the method further comprises:

[0080] Take a photo of the R+1 version of the transaction log to generate a log record snapshot.

[0081] When S600 is executed, the R+1th version of the transaction log to be written is concurrently written into the log record. After the R+1th version of the transaction log is generated, a photo of the R+1th version of the transaction log is taken to generate a log record snapshot.

[0082] Specifically, in an implementation method provided by the present application, each transaction operation will generate a metadata file, which includes all actions performed in this operation. Each time a new metadata file is generated, a new transaction log snapshot will be generated. The version of the log snapshot is consistent with the ID number of the corresponding version of the transaction log record, and it is continuously incremented according to the transaction log version. A certain version of the transaction log snapshot is obtained by sequentially replaying all transaction log files that are less than or equal to the transaction log snapshot version number. Then, a corresponding relationship between transaction operations, transaction log records, and log record snapshots is established, so that when necessary, the content of the corresponding version of the data table can be read through the log snapshot record.

[0083] Furthermore, in a preferred implementation manner provided by the present application, taking a photo of the transaction log of version R+1 to generate a log record snapshot specifically includes:

[0084] A log record snapshot is generated once every N versions of the transaction log.

[0085] It is understandable that the frequency of generating log record snapshots can be adjusted as needed. That is, the frequency of generating log record snapshots can be set as needed, and the log record snapshot is generated once every N versions (N is a natural number) of the transaction log. For example, N is taken as 3, that is, when the transaction log has the R+1 version, R+2 version, and R+3 version, the log record snapshot is generated once, and the corresponding log record snapshot version is R+3. Of course, N can also be set to other natural numbers as needed.

[0086] Furthermore, in a preferred embodiment provided in the present application, the method further comprises:

[0087] Set up checkpoints for storage at a preset frequency for parallel vectorized processing using Spark.

[0088] Specifically, in one embodiment provided in the present application, in order to better improve performance, log records can be stored in checkpoints regularly. The checkpoint stores all non-redundant operations up to a specific log record ID and is stored in the log of the table in Parquet format. When setting a stored checkpoint, some redundant operations can be deleted. For example, an add operation is first performed on the same data object, and then a delete operation is performed. Then the addition item can be deleted because the data object is no longer part of the table. Or multiple additions to the same data object can be replaced by the last one because the new addition item can only add statistical information. Any client can try to create a checkpoint to a specified log record ID, and if successful, it is written as a Parquet file of the corresponding ID. By setting a checkpoint, the client can find the corresponding log record more efficiently without listing all objects in the log directory. It can be understood that, as needed, the frequency of setting the checkpoint can be preset, that is, the client writes a checkpoint after every N transactions (N is a natural number). For example, if N is 10, the client will write a checkpoint every 10 transactions. Of course, N can also be set to other natural numbers as needed.

[0089] The end result of the checkpointing process is a Parquet file that contains an add record for each object still in the table, a delete record for objects that need to be retained until the retention period expires, and a small number of records for operations such as txn, protocol, and change metadata.

[0090] By setting checkpoints, you can use Spark to perform vectorized processing in parallel. Spark is an open source, parallel data processing framework that can help users easily develop fast and unified big data applications, perform data co-processing, streaming processing, interactive analysis, etc. In addition to persistence operations, Spark also supports a checkpoint mechanism for data preservation, which essentially writes RDD to Disk as a checkpoint.

[0091] RDD (Resilient Distributed Dataset) is the basic data structure of Spark. RDD has the characteristics of being immutable and will run calculations on different nodes of the cluster. The data set in Spark RDD will be logically divided into several partitions, which are distributed on different nodes of the cluster. Based on this feature, RDD can be calculated in parallel on different nodes of the cluster. The RDD data set remembers how it evolved from other RDDs through the so-called lineage relationship. By setting checkpoint fault tolerance on the intermediate node, if a node has problems after the checkpoint and loses the partition, the lineage can be redone from the RDD where the checkpoint was made, which will reduce the overhead. The checkpoint implements the checkpoint function of RDD by writing data to the HDFS file system.

[0092] Furthermore, in a preferred implementation manner provided in the present application, the checkpoint includes the most recent checkpoint, and the most recent checkpoint is stored in a table-level directory.

[0093] It is understandable that when setting a checkpoint, the most recent checkpoint is identified, recorded, and updated, and then the most recent checkpoint (and the log after the checkpoint) can be used to more efficiently locate a specific log record. Specifically, when the checkpoint ID to be written is larger than the current ID in the file, the latest checkpoint ID is written to the most recent checkpoint file through a write operation to update the most recent checkpoint. The most recent checkpoint is stored in a table-level directory, which can more efficiently achieve data synchronization and client access and read and write to the checkpoint (and the log after the checkpoint).

[0094] Furthermore, in a preferred implementation manner provided in the present application, the log records are sorted according to a preset object attribute key value range, and the operation request is configured to include an object attribute key value range.

[0095] Specifically, in one implementation provided in the present application, log records can be rearranged in a data table according to a given object attribute key value range. For example, data objects regarding personal information may usually include attributes such as age, height, and weight. The data in the log records can be rearranged according to multiple attributes such as age range, height range, and weight range, and can be arranged according to multiple dimensions, such as further refining and clustering the age range according to different age groups. In this way, when a user's operation request contains an object attribute key value range, the associated data will have a relatively small attribute key value range under the dimension specified by the user, so that more data objects can be filtered out during the operation, thereby improving the efficiency of the execution of the operation request. By rearranging the log records according to the given object attribute key value range, automatic data layout optimization can be achieved, the object size in the table can be automatically optimized, and the data records can be clustered.

[0096] Furthermore, in a preferred implementation manner provided in the present application, the transaction log is directly stored in the cloud object storage.

[0097] Specifically, in one embodiment provided in the present application, the transaction log and metadata are directly stored in the cloud object storage. Since each transaction log record object contains an array of operations performed on the basis of the previous version of the table to generate the next version, the transaction log record is sequentially used as the ID number of each version according to a series of numbers starting from 0 and increasing, thereby realizing the serialization and traceability of the object storage operation. In this way, by storing the transaction log and metadata directly in the cloud object storage, when the data in the table is stored in Parquet format, as long as a basic connection is implemented to discover the set of objects to be read, the data can be accessed using any software that already supports Parquet, and based on log records, log record snapshots and checkpoints, the independent coordination of the database management of the cloud object storage can be achieved by relying solely on the cloud object storage, without relying on the services of other middleware layers to connect the user end and the storage layer. With the "log record" object as the core data structure used by the client to read a version of the data table, the user can locate other objects in this data table from the "object storage" and complete subsequent queries on the data in the data table, thereby enabling the user to rely on the "object storage" interface to implement "serialization" level transactions.

[0098] Furthermore, in a preferred implementation manner provided in the present application, the transaction log is in JSON format.

[0099] JSON (JavaScript Object Notation) is a lightweight data exchange format. The design goal of JSON is to be easy to read and write, and also easy for machines to parse and generate. JSON is widely used in data exchange, configuration files, logging, etc. JSON is a universal data format that can be used for data exchange between various programming languages. It is small in size and has high transmission efficiency. In particular, since JSON itself has the structured characteristics, the transaction log is in JSON format, making it very convenient to analyze the log. Not only can it be easily read, but it can also query the log through each field, and log collation and analysis can be performed based on this.

[0100] Further, in a preferred implementation manner provided by the present application, concurrently writing the R+1th version of the transaction log to be written into the log record to generate the R+1th version of the transaction log, further comprising:

[0101] When writing to the log record, perform data conflict detection on the object;

[0102] When the object's data conflicts, an exception notification is returned.

[0103] It is understandable that when multiple transactions operate on the same object at the same time, data conflicts are bound to occur, and the intermediate state of the transaction may be exposed to other transactions, causing some transactions to write incorrect values ​​to the database based on the intermediate state of other transactions. When executing the steps of concurrently writing the R+1 version of the transaction log to be written into the log record and generating the R+1 version of the transaction log, since other users may concurrently operate on the object to be operated at the same time and have already written and generated the R+1 version of the transaction log, conflicts may arise between the current write and the inaccurate or lost log record. Therefore, when writing to the log record, data conflict detection of the object can be performed; when a data conflict of the object is detected, an exception notification is returned. This reminds the user of the current abnormal state, making it easier for the user to take specific responses such as continuing to wait or re-initiating the object operation request.

[0104] The following is a detailed description of the implementation process of the big data cloud storage method that meets ACID properties of the present application, combined with specific examples of data storage and operation processes.

[0105] First, in a specific implementation provided by the present application, transaction logs are stored in an object storage format. The organization is as follows: both data and transaction logs are stored in table-level directories, where data is stored in the traditional Hive partition directory format. For example, for a table with a date field, a separate object directory can be created for each date. The details are as follows:

[0106] Under the table-level directory Table, based on the date attribute, a separate object directory is created for each date. The path and file format are as follows:

[0107] TABLE / DATE=YYYY1-MM1-DD1 / NAME1.parquet

[0108] / NAME2.parquet

[0109] / DATE=YYYY2-MM2-DD2 / NAME3.parquet

[0110] / NAME4.parquet

[0111] The transaction log records the operation and change history. The log is recorded in the TABLE / LOG directory. The specific path and file format are as follows:

[0112] / LOG / 0001.json

[0113] / 0002.json

[0114] / 0003.json

[0115] / 0003.parquet

[0116] / 0004.json

[0117] / 0005.json

[0118] As shown above, the client can try to create a checkpoint to a specified log record ID, and if successful, write it to a .Parquet file with the corresponding ID. For example, 0003.parquet means the checkpoint up to and including the 0003.json record.

[0119] Finally, the client needs to efficiently find the last checkpoint (and the log after the checkpoint) without listing all objects in the TABLE / LOG directory. The specific path and file format are as follows:

[0120] / LOG / 0001.json

[0121] / ……

[0122] / 0005.json

[0123] / Last_Checkpoint

[0124] The latest checkpoint ID is written in the Last_Checkpoint file. For example, if {version: "00003"} is written in the Last_Checkpoint file, it means that the ID of the current last checkpoint is 0003. The client can obtain the current log record information by reading the checkpoint file (0003.parquet) corresponding to the last checkpoint ID and the subsequent logs.

[0125] Next, the process of implementing the big data cloud storage method that meets ACID properties of the present application is further described in combination with the operation flow and access process of reading and writing tables.

[0126] First, for table read operations, the client uses the transaction log record object to read the core data structure used when reading a certain version of the data table. For example, by reading the 00003.json log object, the user can locate other objects in this data table from the object storage and complete subsequent queries on the data in the data table. The details are as follows:

[0127] Read the Last_Checkpoint object in the TABLE / LOG directory. If the object exists, read the ID of the last checkpoint.

[0128] Perform a LIST operation in the object storage TABLE / LOG directory. If the ID of the last checkpoint exists, start with this ID. If not, find the most recent .parquet file and all the .json files behind it, so as to obtain the list of all files required to restore the entire table from the most recent "snapshot". And use the "snapshot" (if it exists) and subsequent "log records" to reconstruct the state of the data table. In the table reading operation, parallel reading is supported. For example, when using Spark to read files, Spark job can be used to read .parquet snapshot files and .json log records in parallel. Then, statistical information can be used to locate the set of data objects related to the read transaction. These related data objects can also be read in parallel in the started spark cluster or other computing clusters.

[0129] For table write operations, first find the most recent transaction log record ID, such as R, and obtain the Rth version of the table data through a table read operation to read the R version of the table data. If necessary, you can also use the same steps as the table read operation to merge the most recent .parquet file and all subsequent .json files to generate the latest status of the data table, and then read the object list of the data related to the data table. Then write the transaction-related data objects to the correct data table path in parallel, and use GUID to generate the object name. These data objects will be referenced by the latest log record objects.

[0130] Then try to write an R+1 version of the transaction log file. When trying to write the log record of this write transaction to the R+1 version of the .json log record object, if no other client is trying to write to this object, then write normally. If the write fails, retry. You can reuse the previously generated data objects in the retry, and then write these data objects to the new .log log record object generated by the retry transaction.

[0131] At the preset frequency, a new .parquet snapshot object is written for the R+1 version of the log record object. Then, after the write transaction is completed, the Last_Checkpoint file content is updated to point to the R+1 version of the snapshot.

[0132] In summary, the big data cloud storage method that meets ACID properties provided by the present application maintains the information between data objects and data tables through transaction log records stored in cloud objects, serialization of log records, and checkpoints set at a preset frequency, thereby allowing the client to update multiple objects at a time in a serialized manner while maintaining the concurrent performance of reading and writing files, thereby better ensuring ACID transactionality and high-performance operations.

[0133] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.

[0134] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems or computer program products. Therefore, the present application may take the form of a complete hardware embodiment, a complete software embodiment or an embodiment combining software and hardware. Moreover, the present application may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes.

[0135] The above is only an embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the scope of the claims of the present application.

Claims

1. A big data cloud storage method that meets ACID properties, characterized in that , including the following steps: Receiving a user's operation request for a cloud storage object; Get the most recent R version of the transaction log; According to the transaction log of version R, find the corresponding object to be operated from the storage file in Parquet format; According to the operation request, process the object to be operated and generate the update object; Generate the R+1th version of the transaction log to be written; Concurrently, the R+1th version of the transaction log to be written is written to the log record to generate the R+1th version of the transaction log; The Rth version transaction log and the R+1th version transaction log are stored in the table-level directory , Store transaction logs in object storage tables; The objects are stored in partitioned directories, the contents of the table are stored in Apache Parquet objects, organized into directories using Hive's partition naming conventions, tables are stored as collections of objects, and records are partitioned into directories based on one or more attributes; The method further includes: taking a photo of the R+1th version of the transaction log to generate a log record snapshot, specifically including: generating a log record snapshot once every time the transaction log goes through N versions; The method further includes: setting a checkpoint for storage at a preset frequency for vectorized processing in parallel using Spark, the checkpoint storing all non-redundant operations up to a specific log record ID in a log of the table in Parquet format; The checkpoints include the most recent checkpoint, which is stored in the table-level directory; The method further includes: arranging the log records according to a preset attribute key value range, and the operation request is configured to include an object attribute key value range.

2. The method according to claim 1, characterized in that The method further comprises: When the concurrent execution fails to write the R+1 version of the transaction log to be written into the log record and generate the R+1 version of the transaction log: Get the most recent R+1 version of the transaction log; According to the R+1 version of the transaction log, search for the corresponding object to be operated from the storage file in Parquet format; According to the operation request, process the object to be operated and generate the update object; Generate the R+2 version of the transaction log to be written; Concurrently, the R+2 version of the transaction log to be written is written to the log record to generate the R+2 version of the transaction log.

3. The method according to claim 1, characterized in that The transaction log and the object are both stored in the cloud.

4. The method according to claim 1, characterized in that The transaction log is in JSON format.

5. The method according to claim 1, characterized in that Concurrently, the R+1th version of the transaction log to be written is written to the log record to generate the R+1th version of the transaction log, which also includes: When writing to the log record, perform data conflict detection on the object; When the object's data conflicts, an exception notification is returned.

Citation Information

Patent Citations

  • Spatial data versioning management method based on data lake

    CN116955510A